1 common.test CommonBackdropHTTPRequestTestCase::testBackdropHTTPRequestHeaders()

Tests Content-language headers generated by Backdrop.

File

core/modules/simpletest/tests/common.test, line 1159
Tests for common.inc functionality.

Class

CommonBackdropHTTPRequestTestCase
Test backdrop_http_request().

Code

function testBackdropHTTPRequestHeaders() {
  // Check the default header.
  $request = backdrop_http_request(url('<front>', array('absolute' => TRUE)));
  $this->assertEqual($request->headers['content-language'], 'en', t('Content-Language HTTP header is English.'));

  // Add French language.
  $language = (object) array(
    'langcode' => 'fr',
    'name' => 'French',
  );
  language_save($language);

  // Request home page in French and check for matching Content-language.
  $request = backdrop_http_request(url('<front>', array('absolute' => TRUE, 'language' => $language)));
  $this->assertEqual($request->headers['content-language'], 'fr', t('Content-Language HTTP header is French.'));
}