diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleCommentLanguageTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleCommentLanguageTest.php index 6776e31..17ba926 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleCommentLanguageTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleCommentLanguageTest.php @@ -110,7 +110,7 @@ class LocaleCommentLanguageTest extends WebTestBase { ->execute() ->fetchObject(); $args = array('%node_language' => $node_langcode, '%comment_language' => $comment->langcode, '%langcode' => $langcode); - $this->assertEqual($comment->langcode, $langcode, t('The comment posted with content language %langcode and belonging to the node with language %node_language has language %comment_language', $args)); + $this->assertEqual($comment->langcode, $langcode, format_string('The comment posted with content language %langcode and belonging to the node with language %node_language has language %comment_language', $args)); } } } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php index a41d68b..96dd07d 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php @@ -86,26 +86,26 @@ class LocaleContentTest extends WebTestBase { // Set "Basic page" content type to use multilingual support. $this->drupalGet('admin/structure/types/manage/page'); - $this->assertText(t('Language settings'), t('Multilingual support fieldset present on content type configuration form.')); + $this->assertText(t('Language settings'), 'Multilingual support fieldset present on content type configuration form.'); $edit = array( 'node_type_language_hidden' => FALSE, ); $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); - $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), t('Basic page content type has been updated.')); + $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), 'Basic page content type has been updated.'); $this->drupalLogout(); // Verify language selection is not present on add article form. $this->drupalLogin($web_user); $this->drupalGet('node/add/article'); // Verify language select list is not present. - $this->assertNoFieldByName('language', NULL, t('Language select not present on add article form.')); + $this->assertNoFieldByName('language', NULL, 'Language select not present on add article form.'); // Verify language selection appears on add "Basic page" form. $this->drupalGet('node/add/page'); // Verify language select list is present. - $this->assertFieldByName('langcode', NULL, t('Language select present on add Basic page form.')); + $this->assertFieldByName('langcode', NULL, 'Language select present on add Basic page form.'); // Ensure language appears. - $this->assertText($name, t('Language present.')); + $this->assertText($name, 'Language present.'); // Create "Basic page" content. $node_title = $this->randomName(); @@ -120,13 +120,13 @@ class LocaleContentTest extends WebTestBase { // Edit the content and ensure correct language is selected. $path = 'node/' . $node->nid . '/edit'; $this->drupalGet($path); - $this->assertRaw('', t('Correct language selected.')); + $this->assertRaw('', 'Correct language selected.'); // Ensure we can change the node language. $edit = array( 'langcode' => 'en', ); $this->drupalPost($path, $edit, t('Save')); - $this->assertRaw(t('%title has been updated.', array('%title' => $node_title)), t('Basic page content updated.')); + $this->assertRaw(t('%title has been updated.', array('%title' => $node_title)), 'Basic page content updated.'); $this->drupalLogout(); } @@ -159,7 +159,7 @@ class LocaleContentTest extends WebTestBase { 'node_type_language_hidden' => FALSE, ); $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type')); - $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Article')), t('Article content type has been updated.')); + $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Article')), 'Article content type has been updated.'); $this->drupalLogout(); // Login as web user to add new article. @@ -174,23 +174,23 @@ class LocaleContentTest extends WebTestBase { // Check if English node does not have lang tag. $pattern = '|id="node-' . $node_en->nid . '"[^<>]*lang="en"|'; - $this->assertNoPattern($pattern, t('The lang tag has not been assigned to the English node.')); + $this->assertNoPattern($pattern, 'The lang tag has not been assigned to the English node.'); // Check if English node does not have dir tag. $pattern = '|id="node-' . $node_en->nid . '"[^<>]*dir="ltr"|'; - $this->assertNoPattern($pattern, t('The dir tag has not been assigned to the English node.')); + $this->assertNoPattern($pattern, 'The dir tag has not been assigned to the English node.'); // Check if Arabic node has lang="ar" & dir="rtl" tags. $pattern = '|id="node-' . $node_ar->nid . '"[^<>]*lang="ar" dir="rtl"|'; - $this->assertPattern($pattern, t('The lang and dir tags have been assigned correctly to the Arabic node.')); + $this->assertPattern($pattern, 'The lang and dir tags have been assigned correctly to the Arabic node.'); // Check if Spanish node has lang="es" tag. $pattern = '|id="node-' . $node_es->nid . '"[^<>]*lang="es"|'; - $this->assertPattern($pattern, t('The lang tag has been assigned correctly to the Spanish node.')); + $this->assertPattern($pattern, 'The lang tag has been assigned correctly to the Spanish node.'); // Check if Spanish node does not have dir="ltr" tag. $pattern = '|id="node-' . $node_es->nid . '"[^<>]*lang="es" dir="ltr"|'; - $this->assertNoPattern($pattern, t('The dir tag has not been assigned to the Spanish node.')); + $this->assertNoPattern($pattern, 'The dir tag has not been assigned to the Spanish node.'); $this->drupalLogout(); } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php index 7ae1bf7..ddcebb8 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleExportTest.php @@ -65,9 +65,9 @@ class LocaleExportTest extends WebTestBase { ), t('Export')); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal', t('Exported French translation file.')); + $this->assertRaw('# French translation of Drupal', 'Exported French translation file.'); // Ensure our imported translations exist in the file. - $this->assertRaw('msgstr "lundi"', t('French translations present in exported file.')); + $this->assertRaw('msgstr "lundi"', 'French translations present in exported file.'); // Import some more French translations which will be marked as customized. $name = tempnam('temporary://', "po2_") . '.po'; @@ -92,11 +92,11 @@ class LocaleExportTest extends WebTestBase { ), t('Export')); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal', t('Exported French translation file with only customized strings.')); + $this->assertRaw('# French translation of Drupal', 'Exported French translation file with only customized strings.'); // Ensure the customized translations exist in the file. - $this->assertRaw('msgstr "janvier"', t('French custom translation present in exported file.')); + $this->assertRaw('msgstr "janvier"', 'French custom translation present in exported file.'); // Ensure no untranslated strings exist in the file. - $this->assertNoRaw('msgid "February"', t('Untranslated string not present in exported file.')); + $this->assertNoRaw('msgid "February"', 'Untranslated string not present in exported file.'); // Export only untranslated French translations. $this->drupalPost('admin/config/regional/translate/export', array( @@ -107,11 +107,11 @@ class LocaleExportTest extends WebTestBase { ), t('Export')); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal', t('Exported French translation file with only untranslated strings.')); + $this->assertRaw('# French translation of Drupal', 'Exported French translation file with only untranslated strings.'); // Ensure no customized translations exist in the file. - $this->assertNoRaw('msgstr "janvier"', t('French custom translation not present in exported file.')); + $this->assertNoRaw('msgstr "janvier"', 'French custom translation not present in exported file.'); // Ensure the untranslated strings exist in the file. - $this->assertRaw('msgid "February"', t('Untranslated string present in exported file.')); + $this->assertRaw('msgid "February"', 'Untranslated string present in exported file.'); } /** @@ -125,7 +125,7 @@ class LocaleExportTest extends WebTestBase { // Get the translation template file. $this->drupalPost('admin/config/regional/translate/export', array(), t('Export')); // Ensure we have a translation file. - $this->assertRaw('# LANGUAGE translation of PROJECT', t('Exported translation template file.')); + $this->assertRaw('# LANGUAGE translation of PROJECT', 'Exported translation template file.'); } /** diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php index 06d292f..7adafdb 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php @@ -50,7 +50,7 @@ class LocaleFileImportStatus extends WebTestBase { $edit = array('predefined_langcode' => $langcode); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language')); drupal_static_reset('language_list'); - $this->assertTrue(language_load($langcode), t('Language %langcode added.', array('%langcode' => $langcode))); + $this->assertTrue(language_load($langcode), format_string('Language %langcode added.', array('%langcode' => $langcode))); } /** @@ -96,8 +96,8 @@ class LocaleFileImportStatus extends WebTestBase { $this->assertEqual(1, $count, format_plural($count, '@count file registered in {locale_file}.', '@count files registered in {locale_file}.')); $result = db_query('SELECT langcode, uri FROM {locale_file}')->fetchAssoc(); - $this->assertEqual($result['uri'], $testfile_uri, t('%uri is in {locale_file}.', array('%uri' => $result['uri']))); - $this->assertEqual($result['langcode'], $langcode, t('Langcode is %langcode.', array('%langcode' => $langcode))); + $this->assertEqual($result['uri'], $testfile_uri, format_string('%uri is in {locale_file}.', array('%uri' => $result['uri']))); + $this->assertEqual($result['langcode'], $langcode, format_string('Langcode is %langcode.', array('%langcode' => $langcode))); return $file; } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php index 4dca9e7..6ba938b 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php @@ -55,17 +55,17 @@ class LocaleImportFunctionalTest extends WebTestBase { )); // The import should automatically create the corresponding language. - $this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), t('The language has been automatically created.')); + $this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), 'The language has been automatically created.'); // The import should have created 8 strings. - $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 8, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.')); + $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 8, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.'); // This import should have saved plural forms to have 2 variants. $locale_plurals = variable_get('locale_translation_plurals', array()); - $this->assert($locale_plurals['fr']['plurals'] == 2, t('Plural number initialized.')); + $this->assert($locale_plurals['fr']['plurals'] == 2, 'Plural number initialized.'); // Ensure we were redirected correctly. - $this->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), 'Correct page redirection.'); // Try importing a .po file with invalid tags. @@ -74,9 +74,9 @@ class LocaleImportFunctionalTest extends WebTestBase { )); // The import should have created 1 string and rejected 2. - $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.')); + $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.'); $skip_message = format_plural(2, 'A translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', array('@url' => url('admin/reports/dblog'))); - $this->assertRaw($skip_message, t('Unsafe strings were skipped.')); + $this->assertRaw($skip_message, 'Unsafe strings were skipped.'); // Try importing a zero byte sized .po file. $this->importPoFile($this->getEmptyPoFile(), array( @@ -92,8 +92,8 @@ class LocaleImportFunctionalTest extends WebTestBase { 'langcode' => 'fr', 'files[file]' => $name, ), t('Import')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/import', array('absolute' => TRUE)), t('Correct page redirection.')); - $this->assertText(t('File to import not found.'), t('File to import not found message.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/import', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertText(t('File to import not found.'), 'File to import not found message.'); // Try importing a .po file with overriding strings, and ensure existing @@ -103,7 +103,7 @@ class LocaleImportFunctionalTest extends WebTestBase { )); // The import should have created 1 string. - $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.')); + $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.'); // Ensure string wasn't overwritten. $search = array( 'string' => 'Montag', @@ -111,11 +111,11 @@ class LocaleImportFunctionalTest extends WebTestBase { 'translation' => 'translated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), t('String not overwritten by imported string.')); + $this->assertText(t('No strings available.'), 'String not overwritten by imported string.'); // This import should not have changed number of plural forms. $locale_plurals = variable_get('locale_translation_plurals', array()); - $this->assert($locale_plurals['fr']['plurals'] == 2, t('Plural numbers untouched.')); + $this->assert($locale_plurals['fr']['plurals'] == 2, 'Plural numbers untouched.'); // Try importing a .po file with overriding strings, and ensure existing // strings are overwritten. @@ -125,7 +125,7 @@ class LocaleImportFunctionalTest extends WebTestBase { )); // The import should have updated 2 strings. - $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), t('The translation file was successfully imported.')); + $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), 'The translation file was successfully imported.'); // Ensure string was overwritten. $search = array( 'string' => 'Montag', @@ -133,10 +133,10 @@ class LocaleImportFunctionalTest extends WebTestBase { 'translation' => 'translated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), t('String overwritten by imported string.')); + $this->assertNoText(t('No strings available.'), 'String overwritten by imported string.'); // This import should have changed number of plural forms. $locale_plurals = variable_get('locale_translation_plurals', array()); - $this->assert($locale_plurals['fr']['plurals'] == 3, t('Plural numbers changed.')); + $this->assert($locale_plurals['fr']['plurals'] == 3, 'Plural numbers changed.'); // Importing a .po file and mark its strings as customized strings. $this->importPoFile($this->getCustomPoFile(), array( @@ -145,12 +145,12 @@ class LocaleImportFunctionalTest extends WebTestBase { )); // The import should have created 6 strings. - $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 6, '%update' => 0, '%delete' => 0)), t('The customized translation file was successfully imported.')); + $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 6, '%update' => 0, '%delete' => 0)), 'The customized translation file was successfully imported.'); // The database should now contain 6 customized strings (two imported // strings are not translated). $count = db_query('SELECT lid FROM {locales_target} WHERE customized = :custom', array(':custom' => 1))->rowCount(); - $this->assertEqual($count, 6, t('Customized translations succesfully imported.')); + $this->assertEqual($count, 6, 'Customized translations succesfully imported.'); // Try importing a .po file with overriding strings, and ensure existing // customized strings are kept. @@ -161,7 +161,7 @@ class LocaleImportFunctionalTest extends WebTestBase { )); // The import should have created 1 string. - $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), t('The customized translation file was successfully imported.')); + $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The customized translation file was successfully imported.'); // Ensure string wasn't overwritten. $search = array( 'string' => 'januari', @@ -169,7 +169,7 @@ class LocaleImportFunctionalTest extends WebTestBase { 'translation' => 'translated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), t('Customized string not overwritten by imported string.')); + $this->assertText(t('No strings available.'), 'Customized string not overwritten by imported string.'); // Try importing a .po file with overriding strings, and ensure existing // customized strings are overwritten. @@ -180,7 +180,7 @@ class LocaleImportFunctionalTest extends WebTestBase { )); // The import should have updated 2 strings. - $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), t('The customized translation file was successfully imported.')); + $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), 'The customized translation file was successfully imported.'); // Ensure string was overwritten. $search = array( 'string' => 'januari', @@ -188,7 +188,7 @@ class LocaleImportFunctionalTest extends WebTestBase { 'translation' => 'translated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), t('Customized string overwritten by imported string.')); + $this->assertNoText(t('No strings available.'), 'Customized string overwritten by imported string.'); } @@ -212,8 +212,8 @@ class LocaleImportFunctionalTest extends WebTestBase { // Ensure the translation file was automatically imported when language was // added. - $this->assertText(t('One translation file imported.'), t('Language file automatically imported.')); - $this->assertText(t('A translation string was skipped because of disallowed or malformed HTML'), t('Language file automatically imported.')); + $this->assertText(t('One translation file imported.'), 'Language file automatically imported.'); + $this->assertText(t('A translation string was skipped because of disallowed or malformed HTML'), 'Language file automatically imported.'); // Ensure strings were successfully imported. $search = array( @@ -222,7 +222,7 @@ class LocaleImportFunctionalTest extends WebTestBase { 'translation' => 'translated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), t('String successfully imported.')); + $this->assertNoText(t('No strings available.'), 'String successfully imported.'); // Ensure multiline string was imported. $search = array( @@ -231,7 +231,7 @@ class LocaleImportFunctionalTest extends WebTestBase { 'translation' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText('Multiline translation string to make sure that import works with it.', t('String successfully imported.')); + $this->assertText('Multiline translation string to make sure that import works with it.', 'String successfully imported.'); // Ensure 'Allowed HTML source string' was imported but the translation for // 'Another allowed HTML source string' was not because it contains invalid @@ -242,8 +242,8 @@ class LocaleImportFunctionalTest extends WebTestBase { 'translation' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText('Allowed HTML source string', t('String successfully imported.')); - $this->assertNoText('Another allowed HTML source string', t('String with disallowed translation not imported.')); + $this->assertText('Allowed HTML source string', 'String successfully imported.'); + $this->assertNoText('Another allowed HTML source string', 'String with disallowed translation not imported.'); } /** @@ -255,8 +255,8 @@ class LocaleImportFunctionalTest extends WebTestBase { 'langcode' => 'hr', )); - $this->assertIdentical(t('May', array(), array('langcode' => 'hr', 'context' => 'Long month name')), 'Svibanj', t('Long month name context is working.')); - $this->assertIdentical(t('May', array(), array('langcode' => 'hr')), 'Svi.', t('Default context is working.')); + $this->assertIdentical(t('May', array(), array('langcode' => 'hr', 'context' => 'Long month name')), 'Svibanj', 'Long month name context is working.'); + $this->assertIdentical(t('May', array(), array('langcode' => 'hr')), 'Svi.', 'Default context is working.'); } /** @@ -270,15 +270,15 @@ class LocaleImportFunctionalTest extends WebTestBase { 'langcode' => $langcode, )); - $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.')); - $this->assertIdentical(t('Operations', array(), array('langcode' => $langcode)), 'Műveletek', t('String imported and translated.')); + $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.'); + $this->assertIdentical(t('Operations', array(), array('langcode' => $langcode)), 'Műveletek', 'String imported and translated.'); // Try importing a .po file. $this->importPoFile($this->getPoFileWithEmptyMsgstr(), array( 'langcode' => $langcode, 'overwrite_options[not_customized]' => TRUE, )); - $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 0, '%update' => 0, '%delete' => 1)), t('The translation file was successfully imported.')); + $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 0, '%update' => 0, '%delete' => 1)), 'The translation file was successfully imported.'); $str = "Operations"; $search = array( @@ -287,7 +287,7 @@ class LocaleImportFunctionalTest extends WebTestBase { 'translation' => 'untranslated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText($str, t('Search found the string as untranslated.')); + $this->assertText($str, 'Search found the string as untranslated.'); } /** diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleInstallTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleInstallTest.php index fa6aafc..742bf4f 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleInstallTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleInstallTest.php @@ -42,6 +42,6 @@ class LocaleInstallTest extends WebTestBase { function testFunctionSignatures() { $reflector_t = new ReflectionFunction('t'); $reflector_st = new ReflectionFunction('st'); - $this->assertEqual($reflector_t->getParameters(), $reflector_st->getParameters(), t('Function signatures of t() and st() are equal.')); + $this->assertEqual($reflector_t->getParameters(), $reflector_st->getParameters(), 'Function signatures of t() and st() are equal.'); } } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php index 8962267..1dcc285 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php @@ -93,12 +93,18 @@ class LocaleJavascriptTranslation extends WebTestBase { $args = array('%source' => $str, '%context' => $context); // Make sure that the string was found in the file. - $this->assertTrue(isset($source_strings[$str]), t("Found source string: %source", $args)); + $this->assertTrue(isset($source_strings[$str]), format_string("Found source string: %source", $args)); // Make sure that the proper context was matched. - $this->assertTrue(isset($source_strings[$str]) && $source_strings[$str] === $context, strlen($context) > 0 ? t("Context for %source is %context", $args) : t("Context for %source is blank", $args)); + $message = strlen($context) > 0 ? 'Context for %source is %context' : 'Context for %source is blank'; + if (isset($source_strings[$str]) && $source_strings[$str] === $context) { + $this->pass(format_string($message, $args)); + } + else { + $this->fail(format_string($message, $args)); + } } - $this->assertEqual(count($source_strings), count($test_strings), t("Found correct number of source strings.")); + $this->assertEqual(count($source_strings), count($test_strings), "Found correct number of source strings."); } } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php index 0581124..912d657 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php @@ -38,6 +38,6 @@ class LocaleLibraryInfoAlterTest extends WebTestBase { public function testLibraryInfoAlter() { drupal_add_library('system', 'jquery.ui.datepicker'); $scripts = drupal_get_js(); - $this->assertTrue(strpos($scripts, 'locale.datepicker.js'), t('locale.datepicker.js added to scripts.')); + $this->assertTrue(strpos($scripts, 'locale.datepicker.js'), 'locale.datepicker.js added to scripts.'); } } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php index bafb620..c90695b 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php @@ -68,7 +68,7 @@ class LocalePathTest extends WebTestBase { // Check that the "xx" front page is readily available because path prefix // negotiation is pre-configured. $this->drupalGet($prefix); - $this->assertText(t('Welcome to Drupal'), t('The "xx" front page is readibly available.')); + $this->assertText(t('Welcome to Drupal'), 'The "xx" front page is readibly available.'); // Create a node. $node = $this->drupalCreateNode(array('type' => 'page')); @@ -94,11 +94,11 @@ class LocalePathTest extends WebTestBase { // Confirm English language path alias works. $this->drupalGet($english_path); - $this->assertText($node->label(), t('English alias works.')); + $this->assertText($node->label(), 'English alias works.'); // Confirm custom language path alias works. $this->drupalGet($prefix . '/' . $custom_language_path); - $this->assertText($node->label(), t('Custom language alias works.')); + $this->assertText($node->label(), 'Custom language alias works.'); // Create a custom path. $custom_path = $this->randomName(8); @@ -111,10 +111,10 @@ class LocalePathTest extends WebTestBase { ); path_save($edit); $lookup_path = drupal_lookup_path('alias', 'node/' . $node->nid, 'en'); - $this->assertEqual($english_path, $lookup_path, t('English language alias has priority.')); + $this->assertEqual($english_path, $lookup_path, 'English language alias has priority.'); // Same check for language 'xx'. $lookup_path = drupal_lookup_path('alias', 'node/' . $node->nid, $prefix); - $this->assertEqual($custom_language_path, $lookup_path, t('Custom language alias has priority.')); + $this->assertEqual($custom_language_path, $lookup_path, 'Custom language alias has priority.'); path_delete($edit); // Create language nodes to check priority of aliases. @@ -141,17 +141,17 @@ class LocalePathTest extends WebTestBase { $this->drupalGet(''); $custom_path_url = base_path() . $GLOBALS['script_path'] . $custom_path; $elements = $this->xpath('//a[@href=:href and .=:title]', array(':href' => $custom_path_url, ':title' => $first_node->label())); - $this->assertTrue(!empty($elements), t('First node links to the path alias.')); + $this->assertTrue(!empty($elements), 'First node links to the path alias.'); $elements = $this->xpath('//a[@href=:href and .=:title]', array(':href' => $custom_path_url, ':title' => $second_node->label())); - $this->assertTrue(!empty($elements), t('Second node links to the path alias.')); + $this->assertTrue(!empty($elements), 'Second node links to the path alias.'); // Confirm that the custom path leads to the first node. $this->drupalGet($custom_path); - $this->assertText($first_node->label(), t('Custom alias returns first node.')); + $this->assertText($first_node->label(), 'Custom alias returns first node.'); // Confirm that the custom path with prefix leads to the second node. $this->drupalGet($prefix . '/' . $custom_path); - $this->assertText($second_node->label(), t('Custom alias with prefix returns second node.')); + $this->assertText($second_node->label(), 'Custom alias with prefix returns second node.'); } } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php index f4a56e2..497c824 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php @@ -121,12 +121,24 @@ class LocalePluralFormatTest extends WebTestBase { foreach ($plural_tests as $langcode => $tests) { foreach ($tests as $count => $expected_plural_index) { // Assert that the we get the right plural index. - $this->assertIdentical(locale_get_plural($count, $langcode), $expected_plural_index, 'Computed plural index for ' . $langcode . ' for count ' . $count . ' is ' . $expected_plural_index); + $this->assertIdentical(locale_get_plural($count, $langcode), $expected_plural_index, + format_string('Computed plural index for %langcode for count %count is %expected', array( + '%langcode' => $langcode, + '%count' => $count, + '%expect' => $expected_plural_index + )) + ); // Assert that the we get the right translation for that. Change the // expected index as per the logic for translation lookups. $expected_plural_index = ($count == 1) ? 0 : $expected_plural_index; $expected_plural_string = str_replace('@count', $count, $plural_strings[$langcode][$expected_plural_index]); - $this->assertIdentical(format_plural($count, '1 hour', '@count hours', array(), array('langcode' => $langcode)), $expected_plural_string, 'Plural translation of 1 hours / @count hours for count ' . $count . ' in ' . $langcode . ' is ' . $expected_plural_string); + $this->assertIdentical(format_plural($count, '1 hour', '@count hours', array(), array('langcode' => $langcode)), $expected_plural_string, + format_string('Plural translation of 1 hours / @count hours for count %count in %langcode is %expected', array( + '%count' => $count, + '%langcode' => $langcode, + '%expected' => $expected_plural_string + )) + ); } } } @@ -149,22 +161,22 @@ class LocalePluralFormatTest extends WebTestBase { 'langcode' => 'fr', ), t('Export')); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal', t('Exported French translation file.')); + $this->assertRaw('# French translation of Drupal', 'Exported French translation file.'); // Ensure our imported translations exist in the file. - $this->assertRaw("msgid \"Monday\"\nmsgstr \"lundi\"", t('French translations present in exported file.')); + $this->assertRaw("msgid \"Monday\"\nmsgstr \"lundi\"", 'French translations present in exported file.'); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"1 heure\"\nmsgstr[1] \"@count heures\"", t('Plural translations exported properly.')); + $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"1 heure\"\nmsgstr[1] \"@count heures\"", 'Plural translations exported properly.'); // Get the Croatian translations. $this->drupalPost('admin/config/regional/translate/export', array( 'langcode' => 'hr', ), t('Export')); // Ensure we have a translation file. - $this->assertRaw('# Croatian translation of Drupal', t('Exported Croatian translation file.')); + $this->assertRaw('# Croatian translation of Drupal', 'Exported Croatian translation file.'); // Ensure our imported translations exist in the file. - $this->assertRaw("msgid \"Monday\"\nmsgstr \"Ponedjeljak\"", t('Croatian translations present in exported file.')); + $this->assertRaw("msgid \"Monday\"\nmsgstr \"Ponedjeljak\"", 'Croatian translations present in exported file.'); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata\"\nmsgstr[2] \"@count sati\"", t('Plural translations exported properly.')); + $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata\"\nmsgstr[2] \"@count sati\"", 'Plural translations exported properly.'); // Check if the source appears on the translation page. $this->drupalGet('admin/config/regional/translate'); @@ -245,16 +257,16 @@ class LocalePluralFormatTest extends WebTestBase { 'langcode' => 'fr', ), t('Export')); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"1 heure edited\"\nmsgstr[1] \"@count heures\"", t('Edited French plural translations for hours exported properly.')); - $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"1 jour\"\nmsgstr[1] \"@count jours\"", t('Added French plural translations for days exported properly.')); + $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"1 heure edited\"\nmsgstr[1] \"@count heures\"", 'Edited French plural translations for hours exported properly.'); + $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"1 jour\"\nmsgstr[1] \"@count jours\"", 'Added French plural translations for days exported properly.'); // Get the Croatian translations. $this->drupalPost('admin/config/regional/translate/export', array( 'langcode' => 'hr', ), t('Export')); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata edited\"\nmsgstr[2] \"@count sati\"", t('Edited Croatian plural translations exported properly.')); - $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"@count dan\"\nmsgstr[1] \"@count dana\"\nmsgstr[2] \"@count dana\"", t('Added Croatian plural translations exported properly.')); + $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata edited\"\nmsgstr[2] \"@count sati\"", 'Edited Croatian plural translations exported properly.'); + $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"@count dan\"\nmsgstr[1] \"@count dana\"\nmsgstr[2] \"@count dana\"", 'Added Croatian plural translations exported properly.'); } /** diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationTest.php index 1c7265c..509b272 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationTest.php @@ -63,8 +63,8 @@ class LocaleTranslationTest extends WebTestBase { t($name, array(), array('langcode' => $langcode)); // Reset locale cache. locale_reset(); - $this->assertRaw('"edit-site-default-' . $langcode .'"', t('Language code found.')); - $this->assertText(t($name), t('Test language added.')); + $this->assertRaw('"edit-site-default-' . $langcode .'"', 'Language code found.'); + $this->assertText(t($name), 'Test language added.'); $this->drupalLogout(); // Search for the name and translate it. @@ -75,7 +75,7 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'untranslated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText($name, t('Search found the string as untranslated.')); + $this->assertText($name, 'Search found the string as untranslated.'); // Assume this is the only result, given the random name. // We save the lid from the path. @@ -85,15 +85,15 @@ class LocaleTranslationTest extends WebTestBase { $lid => $this->randomName(), ); // No t() here, it's surely not translated yet. - $this->assertText($name, t('name found on edit screen.')); - $this->assertNoText('English', t('No way to translate the string to English.')); + $this->assertText($name, 'name found on edit screen.'); + $this->assertNoText('English', 'No way to translate the string to English.'); $this->drupalLogout(); $this->drupalLogin($admin_user); $this->drupalPost('admin/config/regional/language/edit/en', array('locale_translate_english' => TRUE), t('Save language')); $this->drupalLogout(); $this->drupalLogin($translate_user); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText($name, t('Search found the string as untranslated.')); + $this->assertText($name, 'Search found the string as untranslated.'); // Assume this is the only result, given the random name. $textarea = current($this->xpath('//textarea')); @@ -102,15 +102,15 @@ class LocaleTranslationTest extends WebTestBase { $lid => $translation, ); $this->drupalPost('admin/config/regional/translate/translate', $edit, t('Save translations')); - $this->assertText(t('The strings have been saved.'), t('The strings have been saved.')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertText(t('The strings have been saved.'), 'The strings have been saved.'); + $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), 'Correct page redirection.'); $search = array( 'string' => $name, 'langcode' => $langcode, 'translation' => 'translated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertRaw($translation, t('Non-English translation properly saved.')); + $this->assertRaw($translation, 'Non-English translation properly saved.'); $search = array( @@ -131,16 +131,16 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'translated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertRaw($translation_to_en, t('English translation properly saved.')); + $this->assertRaw($translation_to_en, 'English translation properly saved.'); - $this->assertTrue($name != $translation && t($name, array(), array('langcode' => $langcode)) == $translation, t('t() works for non-English.')); + $this->assertTrue($name != $translation && t($name, array(), array('langcode' => $langcode)) == $translation, 't() works for non-English.'); // Refresh the locale() cache to get fresh data from t() below. We are in // the same HTTP request and therefore t() is not refreshed by saving the // translation above. locale_reset(); // Now we should get the proper fresh translation from t(). - $this->assertTrue($name != $translation_to_en && t($name, array(), array('langcode' => 'en')) == $translation_to_en, t('t() works for English.')); - $this->assertTrue(t($name, array(), array('langcode' => LANGUAGE_SYSTEM)) == $name, t('t() works for LANGUAGE_SYSTEM.')); + $this->assertTrue($name != $translation_to_en && t($name, array(), array('langcode' => 'en')) == $translation_to_en, 't() works for English.'); + $this->assertTrue(t($name, array(), array('langcode' => LANGUAGE_SYSTEM)) == $name, 't() works for LANGUAGE_SYSTEM.'); $search = array( 'string' => $name, @@ -148,7 +148,7 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'untranslated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), t('String is translated.')); + $this->assertText(t('No strings available.'), 'String is translated.'); $this->drupalLogout(); @@ -159,11 +159,11 @@ class LocaleTranslationTest extends WebTestBase { $this->drupalPost($path, array(), t('Delete')); // We need raw here because %language and %langcode will add HTML. $t_args = array('%language' => $name, '%langcode' => $langcode); - $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), t('The test language has been removed.')); + $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The test language has been removed.'); // Reload to remove $name. $this->drupalGet($path); // Verify that language is no longer found. - $this->assertResponse(404, t('Language no longer found.')); + $this->assertResponse(404, 'Language no longer found.'); $this->drupalLogout(); // Delete the string. @@ -181,7 +181,7 @@ class LocaleTranslationTest extends WebTestBase { $lid => '', ); $this->drupalPost('admin/config/regional/translate/translate', $edit, t('Save translations')); - $this->assertRaw($name, t('The strings have been saved.')); + $this->assertRaw($name, 'The strings have been saved.'); $this->drupalLogin($translate_user); $search = array( 'string' => $name, @@ -189,7 +189,7 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'untranslated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), t('The translation has been removed')); + $this->assertNoText(t('No strings available.'), 'The translation has been removed'); } /* @@ -244,14 +244,14 @@ class LocaleTranslationTest extends WebTestBase { $locale_javascripts = variable_get('locale_translation_javascript', array()); $js_file = 'public://' . variable_get('locale_js_directory', 'languages') . '/' . $langcode . '_' . $locale_javascripts[$langcode] . '.js'; - $this->assertTrue($result = file_exists($js_file), t('JavaScript file created: %file', array('%file' => $result ? $js_file : t('not found')))); + $this->assertTrue($result = file_exists($js_file), format_string('JavaScript file created: %file', array('%file' => $result ? $js_file : 'not found'))); // Test JavaScript translation rebuilding. file_unmanaged_delete($js_file); - $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found')))); + $this->assertTrue($result = !file_exists($js_file), format_string('JavaScript file deleted: %file', array('%file' => $result ? $js_file : 'found'))); cache_invalidate(array('content' => TRUE)); _locale_rebuild_js($langcode); - $this->assertTrue($result = file_exists($js_file), t('JavaScript file rebuilt: %file', array('%file' => $result ? $js_file : t('not found')))); + $this->assertTrue($result = file_exists($js_file), format_string('JavaScript file rebuilt: %file', array('%file' => $result ? $js_file : 'not found'))); } /** @@ -305,8 +305,8 @@ class LocaleTranslationTest extends WebTestBase { $this->drupalPost('admin/config/regional/translate/translate', $edit, t('Save translations')); // Check for a form error on the textarea. $form_class = $this->xpath('//form[@id="locale-translate-edit-form"]//textarea/@class'); - $this->assertNotIdentical(FALSE, strpos($form_class[0], 'error'), t('The string was rejected as unsafe.')); - $this->assertNoText(t('The string has been saved.'), t('The string was not saved.')); + $this->assertNotIdentical(FALSE, strpos($form_class[0], 'error'), 'The string was rejected as unsafe.'); + $this->assertNoText(t('The string has been saved.'), 'The string was not saved.'); } } @@ -366,7 +366,7 @@ class LocaleTranslationTest extends WebTestBase { // assertText() seems to remove the input field where $name always could be // found, so this is not a false assert. See how assertNoText succeeds // later. - $this->assertText($name, t('Search found the string.')); + $this->assertText($name, 'Search found the string.'); // Ensure untranslated string doesn't appear if searching on 'only // translated strings'. @@ -376,7 +376,7 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'translated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), t("Search didn't find the string.")); + $this->assertText(t('No strings available.'), "Search didn't find the string."); // Ensure untranslated string appears if searching on 'only untranslated // strings'. @@ -386,7 +386,7 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'untranslated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), t('Search found the string.')); + $this->assertNoText(t('No strings available.'), 'Search found the string.'); // Add translation. // Assume this is the only result, given the random name. @@ -406,7 +406,7 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'translated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), t('Search found the translation.')); + $this->assertNoText(t('No strings available.'), 'Search found the translation.'); // Ensure translated source string doesn't appear if searching on 'only // untranslated strings'. @@ -416,7 +416,7 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'untranslated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), t("Search didn't find the source string.")); + $this->assertText(t('No strings available.'), "Search didn't find the source string."); // Ensure translated string doesn't appear if searching on 'only // untranslated strings'. @@ -426,7 +426,7 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'untranslated', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), t("Search didn't find the translation.")); + $this->assertText(t('No strings available.'), "Search didn't find the translation."); // Ensure translated string does appear if searching on the custom language. $search = array( @@ -435,7 +435,7 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), t('Search found the translation.')); + $this->assertNoText(t('No strings available.'), 'Search found the translation.'); // Ensure translated string doesn't appear if searching in System (English). $search = array( @@ -444,7 +444,7 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), t("Search didn't find the translation.")); + $this->assertText(t('No strings available.'), "Search didn't find the translation."); // Search for a string that isn't in the system. $unavailable_string = $this->randomName(16); @@ -454,6 +454,6 @@ class LocaleTranslationTest extends WebTestBase { 'translation' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), t("Search didn't find the invalid string.")); + $this->assertText(t('No strings available.'), "Search didn't find the invalid string."); } } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php index 7591f67..7141c0e 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php @@ -60,7 +60,7 @@ class LocaleUninstallTest extends WebTestBase { language(NULL, TRUE); // Check the UI language. drupal_language_initialize(); - $this->assertEqual(language(LANGUAGE_TYPE_INTERFACE)->langcode, $this->langcode, t('Current language: %lang', array('%lang' => language(LANGUAGE_TYPE_INTERFACE)->langcode))); + $this->assertEqual(language(LANGUAGE_TYPE_INTERFACE)->langcode, $this->langcode, format_string('Current language: %lang', array('%lang' => language(LANGUAGE_TYPE_INTERFACE)->langcode))); // Enable multilingual workflow option for articles. variable_set('node_type_language_hidden_article',FALSE); @@ -80,7 +80,7 @@ class LocaleUninstallTest extends WebTestBase { _locale_rebuild_js('fr'); $locale_javascripts = variable_get('locale_translation_javascript', array()); $js_file = 'public://' . variable_get('locale_js_directory', 'languages') . '/fr_' . $locale_javascripts['fr'] . '.js'; - $this->assertTrue($result = file_exists($js_file), t('JavaScript file created: %file', array('%file' => $result ? $js_file : t('none')))); + $this->assertTrue($result = file_exists($js_file), format_string('JavaScript file created: %file', array('%file' => $result ? $js_file : 'none'))); // Disable string caching. variable_set('locale_cache_strings', 0); @@ -106,39 +106,39 @@ class LocaleUninstallTest extends WebTestBase { language(NULL, TRUE); // Check the init language logic. drupal_language_initialize(); - $this->assertEqual(language(LANGUAGE_TYPE_INTERFACE)->langcode, 'en', t('Language after uninstall: %lang', array('%lang' => language(LANGUAGE_TYPE_INTERFACE)->langcode))); + $this->assertEqual(language(LANGUAGE_TYPE_INTERFACE)->langcode, 'en', format_string('Language after uninstall: %lang', array('%lang' => language(LANGUAGE_TYPE_INTERFACE)->langcode))); // Check JavaScript files deletion. - $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found')))); + $this->assertTrue($result = !file_exists($js_file), format_string('JavaScript file deleted: %file', array('%file' => $result ? $js_file : 'found'))); // Check language count. $language_count = variable_get('language_count', 1); - $this->assertEqual($language_count, 1, t('Language count: %count', array('%count' => $language_count))); + $this->assertEqual($language_count, 1, format_string('Language count: %count', array('%count' => $language_count))); // Check language negotiation. require_once DRUPAL_ROOT . '/core/includes/language.inc'; - $this->assertTrue(count(language_types_get_all()) == count(language_types_get_default()), t('Language types reset')); + $this->assertTrue(count(language_types_get_all()) == count(language_types_get_default()), 'Language types reset'); $language_negotiation = language_negotiation_method_get_first(LANGUAGE_TYPE_INTERFACE) == LANGUAGE_NEGOTIATION_DEFAULT; - $this->assertTrue($language_negotiation, t('Interface language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set')))); + $this->assertTrue($language_negotiation, format_string('Interface language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set')))); $language_negotiation = language_negotiation_method_get_first(LANGUAGE_TYPE_CONTENT) == LANGUAGE_NEGOTIATION_DEFAULT; - $this->assertTrue($language_negotiation, t('Content language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set')))); + $this->assertTrue($language_negotiation, format_string('Content language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set')))); $language_negotiation = language_negotiation_method_get_first(LANGUAGE_TYPE_URL) == LANGUAGE_NEGOTIATION_DEFAULT; - $this->assertTrue($language_negotiation, t('URL language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set')))); + $this->assertTrue($language_negotiation, format_string('URL language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set')))); // Check language negotiation method settings. - $this->assertFalse(variable_get('language_negotiation_url_part', FALSE), t('URL language negotiation method indicator settings cleared.')); - $this->assertFalse(variable_get('language_negotiation_session_param', FALSE), t('Visit language negotiation method settings cleared.')); + $this->assertFalse(variable_get('language_negotiation_url_part', FALSE), 'URL language negotiation method indicator settings cleared.'); + $this->assertFalse(variable_get('language_negotiation_session_param', FALSE), 'Visit language negotiation method settings cleared.'); // Check JavaScript parsed. $javascript_parsed_count = count(variable_get('javascript_parsed', array())); - $this->assertEqual($javascript_parsed_count, 0, t('JavaScript parsed count: %count', array('%count' => $javascript_parsed_count))); + $this->assertEqual($javascript_parsed_count, 0, format_string('JavaScript parsed count: %count', array('%count' => $javascript_parsed_count))); // Check JavaScript translations directory. $locale_js_directory = variable_get('locale_js_directory', 'languages'); - $this->assertEqual($locale_js_directory, 'languages', t('JavaScript translations directory: %dir', array('%dir' => $locale_js_directory))); + $this->assertEqual($locale_js_directory, 'languages', format_string('JavaScript translations directory: %dir', array('%dir' => $locale_js_directory))); // Check string caching. $locale_cache_strings = variable_get('locale_cache_strings', 1); - $this->assertEqual($locale_cache_strings, 1, t('String caching: %status', array('%status' => t($locale_cache_strings ? 'enabled': 'disabled')))); + $this->assertEqual($locale_cache_strings, 1, format_string('String caching: %status', array('%status' => t($locale_cache_strings ? 'enabled': 'disabled')))); } }