Commit 18c1d673 authored by Dries's avatar Dries
Browse files

- Patch #673020 by Zoltán Balogh, Gábor Hojtsy, good_man, kalman.hosszu: tests...

- Patch #673020 by Zoltán Balogh, Gábor Hojtsy, good_man, kalman.hosszu: tests for adding the Content-Language HTTP header to the generated page.
parent a58940f1
......@@ -936,7 +936,7 @@ class CommonDrupalHTTPRequestTestCase extends DrupalWebTestCase {
}
function setUp() {
parent::setUp('system_test');
parent::setUp('system_test', 'locale');
}
function testDrupalHTTPRequest() {
......@@ -1033,6 +1033,26 @@ class CommonDrupalHTTPRequestTestCase extends DrupalWebTestCase {
$multiple_redirect_3 = drupal_http_request(url('system-test/multiple-redirects/3', array('absolute' => TRUE)), array('max_redirects' => 3));
$this->assertEqual($multiple_redirect_3->redirect_url, $multiple_redirect_final_url, t('redirect_url contains the final redirection location after 3 redirects.'));
}
/**
* Tests Content-language headers generated by Drupal.
*/
function testDrupalHTTPRequestHeaders() {
// Check the default header.
$request = drupal_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 front page in French and check for matching Content-language.
$request = drupal_http_request(url('<front>', array('absolute' => TRUE, 'language' => $language)));
$this->assertEqual($request->headers['content-language'], 'fr', t('Content-Language HTTP header is French.'));
}
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment