Commit 1518a943 authored by jhodgdon's avatar jhodgdon

Issue #1797360 by xjm: Remove t() from test assertions in language module

parent d57f04d3
......@@ -156,7 +156,7 @@ function testLanguageFromBrowser() {
foreach ($test_cases as $accept_language => $expected_result) {
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = $accept_language;
$result = language_from_browser($languages);
$this->assertIdentical($result, $expected_result, t("Language selection '@accept-language' selects '@result', result = '@actual'", array('@accept-language' => $accept_language, '@result' => $expected_result, '@actual' => isset($result) ? $result : 'none')));
$this->assertIdentical($result, $expected_result, format_string("Language selection '@accept-language' selects '@result', result = '@actual'", array('@accept-language' => $accept_language, '@result' => $expected_result, '@actual' => isset($result) ? $result : 'none')));
}
}
......
......@@ -51,7 +51,7 @@ function testDependencyInjectedNewLanguage() {
$expected = language_default();
$result = language(LANGUAGE_TYPE_INTERFACE);
foreach ($expected as $property => $value) {
$this->assertEqual($expected->$property, $result->$property, t('The dependency injected language object %prop property equals the new Language object %prop property.', array('%prop' => $property)));
$this->assertEqual($expected->$property, $result->$property, format_string('The dependency injected language object %prop property equals the new Language object %prop property.', array('%prop' => $property)));
}
}
......@@ -81,7 +81,7 @@ function testDependencyInjectedNewDefaultLanguage() {
$expected = new Language($new_language_default);
$result = language(LANGUAGE_TYPE_INTERFACE);
foreach ($expected as $property => $value) {
$this->assertEqual($expected->$property, $result->$property, t('The dependency injected language object %prop property equals the default language object %prop property.', array('%prop' => $property)));
$this->assertEqual($expected->$property, $result->$property, format_string('The dependency injected language object %prop property equals the default language object %prop property.', array('%prop' => $property)));
}
// Delete the language_default variable we previously set.
......
......@@ -56,7 +56,7 @@ function testInfoAlterations() {
$this->languageNegotiationUpdate();
$type = LANGUAGE_TYPE_CONTENT;
$language_types = variable_get('language_types', language_types_get_default());
$this->assertTrue($language_types[$type], t('Content language type is configurable.'));
$this->assertTrue($language_types[$type], 'Content language type is configurable.');
// Enable some core and custom language negotiation methods. The test
// language type is supposed to be configurable.
......@@ -76,18 +76,18 @@ function testInfoAlterations() {
variable_set('language_test_language_negotiation_info_alter', TRUE);
$this->languageNegotiationUpdate();
$negotiation = variable_get("language_negotiation_$type", array());
$this->assertFalse(isset($negotiation[$interface_method_id]), t('Interface language negotiation method removed from the stored settings.'));
$this->assertNoFieldByXPath("//input[@name=\"$form_field\"]", NULL, t('Interface language negotiation method unavailable.'));
$this->assertFalse(isset($negotiation[$interface_method_id]), 'Interface language negotiation method removed from the stored settings.');
$this->assertNoFieldByXPath("//input[@name=\"$form_field\"]", NULL, 'Interface language negotiation method unavailable.');
// Check that type-specific language negotiation methods can be assigned
// only to the corresponding language types.
foreach (language_types_get_configurable() as $type) {
$form_field = $type . '[enabled][test_language_negotiation_method_ts]';
if ($type == $test_type) {
$this->assertFieldByXPath("//input[@name=\"$form_field\"]", NULL, t('Type-specific test language negotiation method available for %type.', array('%type' => $type)));
$this->assertFieldByXPath("//input[@name=\"$form_field\"]", NULL, format_string('Type-specific test language negotiation method available for %type.', array('%type' => $type)));
}
else {
$this->assertNoFieldByXPath("//input[@name=\"$form_field\"]", NULL, t('Type-specific test language negotiation method unavailable for %type.', array('%type' => $type)));
$this->assertNoFieldByXPath("//input[@name=\"$form_field\"]", NULL, format_string('Type-specific test language negotiation method unavailable for %type.', array('%type' => $type)));
}
}
......@@ -97,7 +97,7 @@ function testInfoAlterations() {
foreach (language_types_get_all() as $type) {
$langcode = $last[$type];
$value = $type == LANGUAGE_TYPE_CONTENT || strpos($type, 'test') !== FALSE ? 'it' : 'en';
$this->assertEqual($langcode, $value, t('The negotiated language for %type is %language', array('%type' => $type, '%language' => $langcode)));
$this->assertEqual($langcode, $value, format_string('The negotiated language for %type is %language', array('%type' => $type, '%language' => $langcode)));
}
// Disable language_test and check that everything is set back to the
......@@ -106,7 +106,7 @@ function testInfoAlterations() {
// Check that only the core language types are available.
foreach (language_types_get_all() as $type) {
$this->assertTrue(strpos($type, 'test') === FALSE, t('The %type language is still available', array('%type' => $type)));
$this->assertTrue(strpos($type, 'test') === FALSE, format_string('The %type language is still available', array('%type' => $type)));
}
// Check that fixed language types are properly configured, even those
......@@ -116,11 +116,11 @@ function testInfoAlterations() {
// Check that unavailable language negotiation methods are not present in
// the negotiation settings.
$negotiation = variable_get("language_negotiation_$type", array());
$this->assertFalse(isset($negotiation[$test_method_id]), t('The disabled test language negotiation method is not part of the content language negotiation settings.'));
$this->assertFalse(isset($negotiation[$test_method_id]), 'The disabled test language negotiation method is not part of the content language negotiation settings.');
// Check that configuration page presents the correct options and settings.
$this->assertNoRaw(t('Test language detection'), t('No test language type configuration available.'));
$this->assertNoRaw(t('This is a test language negotiation method'), t('No test language negotiation method available.'));
$this->assertNoRaw(t('Test language detection'), 'No test language type configuration available.');
$this->assertNoRaw(t('This is a test language negotiation method'), 'No test language negotiation method available.');
}
/**
......@@ -165,7 +165,7 @@ protected function checkFixedLanguageTypes() {
list(, $info_id) = each($info['fixed']);
$equal = $info_id == $id;
}
$this->assertTrue($equal, t('language negotiation for %type is properly set up', array('%type' => $type)));
$this->assertTrue($equal, format_string('language negotiation for %type is properly set up', array('%type' => $type)));
}
}
}
......
......@@ -49,8 +49,8 @@ function setUp() {
$this->drupalPost('admin/config/regional/language/delete/en', array(), t('Delete'));
// Verify that French is the only language.
$this->assertFalse(language_multilingual(), t('Site is mono-lingual'));
$this->assertEqual(language_default()->langcode, 'fr', t('French is the default language'));
$this->assertFalse(language_multilingual(), 'Site is mono-lingual');
$this->assertEqual(language_default()->langcode, 'fr', 'French is the default language');
// Set language detection to URL.
$edit = array('language_interface[enabled][language-url]' => TRUE);
......
......@@ -60,7 +60,7 @@ function testLanguageBlock() {
// Assert that the language switching block is displayed on the frontpage.
$this->drupalGet('');
$this->assertText(t('Languages'), t('Language switcher block found.'));
$this->assertText(t('Languages'), 'Language switcher block found.');
// Assert that only the current language is marked as active.
list($language_switcher) = $this->xpath('//div[@id=:id]/div[@class="content"]', array(':id' => 'block-language-' . str_replace('_', '-', $language_type)));
......@@ -89,7 +89,7 @@ function testLanguageBlock() {
$anchors['inactive'][] = $langcode;
}
}
$this->assertIdentical($links, array('active' => array('en'), 'inactive' => array('fr')), t('Only the current language list item is marked as active on the language switcher block.'));
$this->assertIdentical($anchors, array('active' => array('en'), 'inactive' => array('fr')), t('Only the current language anchor is marked as active on the language switcher block.'));
$this->assertIdentical($links, array('active' => array('en'), 'inactive' => array('fr')), 'Only the current language list item is marked as active on the language switcher block.');
$this->assertIdentical($anchors, array('active' => array('en'), 'inactive' => array('fr')), 'Only the current language anchor is marked as active on the language switcher block.');
}
}
......@@ -391,11 +391,11 @@ function testUrlLanguageFallback() {
// language.
$args = array(':url' => base_path() . $GLOBALS['script_path'] . $langcode_browser_fallback);
$fields = $this->xpath('//div[@id="block-language-language-interface"]//a[@class="language-link active" and starts-with(@href, :url)]', $args);
$this->assertTrue($fields[0] == $languages[$langcode_browser_fallback]->name, t('The browser language is the URL active language'));
$this->assertTrue($fields[0] == $languages[$langcode_browser_fallback]->name, 'The browser language is the URL active language');
// Check that URLs are rewritten using the given browser language.
$fields = $this->xpath('//p[@id="site-name"]/strong/a[@rel="home" and @href=:url]', $args);
$this->assertTrue($fields[0] == 'Drupal', t('URLs are rewritten using the browser language.'));
$this->assertTrue($fields[0] == 'Drupal', 'URLs are rewritten using the browser language.');
}
/**
......@@ -434,13 +434,13 @@ function testLanguageDomain() {
$italian_url = url('admin', array('language' => $languages['it'], 'script' => ''));
$url_scheme = ($is_https) ? 'https://' : 'http://';
$correct_link = $url_scheme . $link;
$this->assertTrue($italian_url == $correct_link, t('The url() function returns the right URL (@url) in accordance with the chosen language', array('@url' => $italian_url)));
$this->assertTrue($italian_url == $correct_link, format_string('The url() function returns the right URL (@url) in accordance with the chosen language', array('@url' => $italian_url)));
// Test HTTPS via options.
variable_set('https', TRUE);
$italian_url = url('admin', array('https' => TRUE, 'language' => $languages['it'], 'script' => ''));
$correct_link = 'https://' . $link;
$this->assertTrue($italian_url == $correct_link, t('The url() function returns the right HTTPS URL (via options) (@url) in accordance with the chosen language', array('@url' => $italian_url)));
$this->assertTrue($italian_url == $correct_link, format_string('The url() function returns the right HTTPS URL (via options) (@url) in accordance with the chosen language', array('@url' => $italian_url)));
variable_set('https', FALSE);
// Test HTTPS via current URL scheme.
......@@ -448,7 +448,7 @@ function testLanguageDomain() {
$is_https = TRUE;
$italian_url = url('admin', array('language' => $languages['it'], 'script' => ''));
$correct_link = 'https://' . $link;
$this->assertTrue($italian_url == $correct_link, t('The url() function returns the right URL (via current URL scheme) (@url) in accordance with the chosen language', array('@url' => $italian_url)));
$this->assertTrue($italian_url == $correct_link, format_string('The url() function returns the right URL (via current URL scheme) (@url) in accordance with the chosen language', array('@url' => $italian_url)));
$is_https = $temp_https;
}
}
......@@ -58,7 +58,7 @@ function testUrlRewritingEdgeCases() {
// Check URL rewriting with a non-installed language.
$non_existing = language_default();
$non_existing->langcode = $this->randomName();
$this->checkUrl($non_existing, t('Path language is ignored if language is not installed.'), t('URL language negotiation does not work with non-installed languages'));
$this->checkUrl($non_existing, 'Path language is ignored if language is not installed.', 'URL language negotiation does not work with non-installed languages');
}
/**
......
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