diff options
Diffstat (limited to 'modules/locale/locale.test')
-rw-r--r-- | modules/locale/locale.test | 280 |
1 files changed, 140 insertions, 140 deletions
diff --git a/modules/locale/locale.test b/modules/locale/locale.test index 03dce7ec7..e6c7cac81 100644 --- a/modules/locale/locale.test +++ b/modules/locale/locale.test @@ -51,8 +51,8 @@ class LocaleConfigurationTest extends DrupalWebTestCase { 'langcode' => 'fr', ); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language')); - $this->assertText('fr', 'Language added successfully.'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertText('fr', t('Language added successfully.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.')); // Add custom language. // Code for the language. @@ -71,79 +71,79 @@ class LocaleConfigurationTest extends DrupalWebTestCase { 'direction' => '0', ); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); - $this->assertText($langcode, 'Language code found.'); - $this->assertText($name, 'Name found.'); - $this->assertText($native, 'Native found.'); - $this->assertText($native, 'Test language added.'); + $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertText($langcode, t('Language code found.')); + $this->assertText($name, t('Name found.')); + $this->assertText($native, t('Native found.')); + $this->assertText($native, t('Test language added.')); // Check if we can change the default language. $path = 'admin/config/regional/language'; $this->drupalGet($path); - $this->assertFieldChecked('edit-site-default-en', 'English is the default language.'); + $this->assertFieldChecked('edit-site-default-en', t('English is the default language.')); // Change the default language. $edit = array( 'site_default' => $langcode, ); $this->drupalPost(NULL, $edit, t('Save configuration')); - $this->assertNoFieldChecked('edit-site-default-en', 'Default language updated.'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertNoFieldChecked('edit-site-default-en', t('Default language updated.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.')); // Ensure we can't delete the default language. $this->drupalGet('admin/config/regional/language/delete/' . $langcode); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); - $this->assertText(t('The default language cannot be deleted.'), 'Failed to delete the default language.'); + $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertText(t('The default language cannot be deleted.'), t('Failed to delete the default language.')); // Check if we can disable a language. $edit = array( 'enabled[en]' => FALSE, ); $this->drupalPost($path, $edit, t('Save configuration')); - $this->assertNoFieldChecked('edit-enabled-en', 'Language disabled.'); + $this->assertNoFieldChecked('edit-enabled-en', t('Language disabled.')); // Set disabled language to be the default and ensure it is re-enabled. $edit = array( 'site_default' => 'en', ); $this->drupalPost(NULL, $edit, t('Save configuration')); - $this->assertFieldChecked('edit-enabled-en', 'Default language re-enabled.'); + $this->assertFieldChecked('edit-enabled-en', t('Default language re-enabled.')); // Ensure 'edit' link works. $this->clickLink(t('edit')); - $this->assertTitle(t('Edit language | Drupal'), 'Page title is "Edit language".'); + $this->assertTitle(t('Edit language | Drupal'), t('Page title is "Edit language".')); // Edit a language. $name = $this->randomName(16); $edit = array( 'name' => $name, ); $this->drupalPost('admin/config/regional/language/edit/' . $langcode, $edit, t('Save language')); - $this->assertRaw($name, 'The language has been updated.'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertRaw($name, t('The language has been updated.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.')); // Ensure 'delete' link works. $this->drupalGet('admin/config/regional/language'); $this->clickLink(t('delete')); - $this->assertText(t('Are you sure you want to delete the language'), '"delete" link is correct.'); + $this->assertText(t('Are you sure you want to delete the language'), t('"delete" link is correct.')); // Delete the language. $this->drupalGet('admin/config/regional/language/delete/' . $langcode); // First test the 'cancel' link. $this->clickLink(t('Cancel')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); - $this->assertRaw($name, 'The language was not deleted.'); + $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertRaw($name, t('The language was not deleted.')); // Delete the language for real. This a confirm form, we do not need any // fields changed. $this->drupalPost('admin/config/regional/language/delete/' . $langcode, array(), t('Delete')); // We need raw here because %locale will add HTML. - $this->assertRaw(t('The language %locale has been removed.', array('%locale' => $name)), 'The test language has been removed.'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertRaw(t('The language %locale has been removed.', array('%locale' => $name)), t('The test language has been removed.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.')); // Verify that language is no longer found. $this->drupalGet('admin/config/regional/language/delete/' . $langcode); - $this->assertResponse(404, 'Language no longer found.'); + $this->assertResponse(404, t('Language no longer found.')); // Ensure we can't delete the English language. $this->drupalGet('admin/config/regional/language/delete/en'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); - $this->assertText(t('The English language cannot be deleted.'), 'Failed to delete English language.'); + $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertText(t('The English language cannot be deleted.'), t('Failed to delete English language.')); } } @@ -202,12 +202,12 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { t($name, array(), array('langcode' => $langcode)); // Reset locale cache. locale_reset(); - $this->assertText($langcode, 'Language code found.'); - $this->assertText($name, 'Name found.'); - $this->assertText($native, 'Native found.'); + $this->assertText($langcode, t('Language code found.')); + $this->assertText($name, t('Name found.')); + $this->assertText($native, t('Native found.')); // No t() here, we do not want to add this string to the database and it's // surely not translated yet. - $this->assertText($native, 'Test language added.'); + $this->assertText($native, t('Test language added.')); $this->drupalLogout(); // Search for the name and translate it. @@ -222,8 +222,8 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { // 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, 'Search found the name.'); - $this->assertRaw($language_indicator, 'Name is untranslated.'); + $this->assertText($name, t('Search found the name.')); + $this->assertRaw($language_indicator, t('Name is untranslated.')); // Assume this is the only result, given the random name. $this->clickLink(t('edit')); // We save the lid from the path. @@ -231,24 +231,24 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { preg_match('!admin/config/regional/translate/edit/(\d+)!', $this->getUrl(), $matches); $lid = $matches[1]; // No t() here, it's surely not translated yet. - $this->assertText($name, 'name found on edit screen.'); + $this->assertText($name, t('name found on edit screen.')); $edit = array( "translations[$langcode]" => $translation, ); $this->drupalPost(NULL, $edit, t('Save translations')); - $this->assertText(t('The string has been saved.'), 'The string has been saved.'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), 'Correct page redirection.'); - $this->assertTrue($name != $translation && t($name, array(), array('langcode' => $langcode)) == $translation, 't() works.'); + $this->assertText(t('The string has been saved.'), t('The string has been saved.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertTrue($name != $translation && t($name, array(), array('langcode' => $langcode)) == $translation, t('t() works.')); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); // The indicator should not be here. - $this->assertNoRaw($language_indicator, 'String is translated.'); + $this->assertNoRaw($language_indicator, t('String is translated.')); // Try to edit a non-existent string and ensure we're redirected correctly. // Assuming we don't have 999,999 strings already. $random_lid = 999999; $this->drupalGet('admin/config/regional/translate/edit/' . $random_lid); - $this->assertText(t('String not found'), 'String not found.'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertText(t('String not found'), t('String not found.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.')); $this->drupalLogout(); // Delete the language. @@ -257,12 +257,12 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { // This a confirm form, we do not need any fields changed. $this->drupalPost($path, array(), t('Delete')); // We need raw here because %locale will add HTML. - $this->assertRaw(t('The language %locale has been removed.', array('%locale' => $name)), 'The test language has been removed.'); + $this->assertRaw(t('The language %locale has been removed.', array('%locale' => $name)), t('The test language has been removed.')); // Reload to remove $name. $this->drupalGet($path); - $this->assertNoText($langcode, 'Language code not found.'); - $this->assertNoText($name, 'Name not found.'); - $this->assertNoText($native, 'Native not found.'); + $this->assertNoText($langcode, t('Language code not found.')); + $this->assertNoText($name, t('Name not found.')); + $this->assertNoText($native, t('Native not found.')); $this->drupalLogout(); // Delete the string. @@ -276,20 +276,20 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); // Assume this is the only result, given the random name. $this->clickLink(t('delete')); - $this->assertText(t('Are you sure you want to delete the string'), '"delete" link is correct.'); + $this->assertText(t('Are you sure you want to delete the string'), t('"delete" link is correct.')); // Delete the string. $path = 'admin/config/regional/translate/delete/' . $lid; $this->drupalGet($path); // First test the 'cancel' link. $this->clickLink(t('Cancel')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), 'Correct page redirection.'); - $this->assertRaw($name, 'The string was not deleted.'); + $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertRaw($name, t('The string was not deleted.')); // Delete the name string. $this->drupalPost('admin/config/regional/translate/delete/' . $lid, array(), t('Delete')); - $this->assertText(t('The string has been removed.'), 'The string has been removed message.'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertText(t('The string has been removed.'), t('The string has been removed message.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.')); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText($name, 'Search now can not find the name.'); + $this->assertNoText($name, t('Search now can not find the name.')); } /* @@ -330,7 +330,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { ->condition('l.textgroup', 'default') ->execute(); $url = 'admin/config/regional/translate/edit/' . $result->fetchObject()->lid; - $edit = array('translations[' . $langcode . ']' => $this->randomName()); + $edit = array('translations['. $langcode .']' => $this->randomName()); $this->drupalPost($url, $edit, t('Save translations')); // Trigger JavaScript translation parsing and building. @@ -345,14 +345,14 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { ->execute() ->fetchObject(); $js_file = 'public://' . variable_get('locale_js_directory', 'languages') . '/' . $langcode . '_' . $file->javascript . '.js'; - $this->assertTrue($result = file_exists($js_file), 'JavaScript file created: ' . $result ? $js_file : t('not found')); + $this->assertTrue($result = file_exists($js_file), t('JavaScript file created: %file', array('%file' => $result ? $js_file : t('not found')))); // Test JavaScript translation rebuilding. file_unmanaged_delete($js_file); - $this->assertTrue($result = !file_exists($js_file), 'JavaScript file deleted: ' . $result ? $js_file : t('found')); + $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found')))); cache_clear_all(); _locale_rebuild_js($langcode); - $this->assertTrue($result = file_exists($js_file), 'JavaScript file rebuilt: ' . $result ? $js_file : t('not found')); + $this->assertTrue($result = file_exists($js_file), t('JavaScript file rebuilt: %file', array('%file' => $result ? $js_file : t('not found')))); } /** @@ -382,7 +382,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { $key = $this->randomName(16); $bad_translations[$key] = '<<SCRIPT>alert("xss");//<</SCRIPT>' . $key; $key = $this->randomName(16); - $bad_translations[$key] = "<BODY ONLOAD=alert('xss')>" . $key; + $bad_translations[$key] ="<BODY ONLOAD=alert('xss')>" . $key; // Add custom language. $edit = array( @@ -405,7 +405,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); // Find the edit path. $content = $this->drupalGetContent(); - $this->assertTrue(preg_match('@(admin/config/regional/translate/edit/[0-9]+)@', $content, $matches), 'Found the edit path.'); + $this->assertTrue(preg_match('@(admin/config/regional/translate/edit/[0-9]+)@', $content, $matches), t('Found the edit path.')); $path = $matches[0]; foreach ($bad_translations as $key => $translation) { $edit = array( @@ -414,8 +414,8 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { $this->drupalPost($path, $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'), 'The string was rejected as unsafe.'); - $this->assertNoText(t('The string has been saved.'), 'The string was not saved.'); + $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.')); } } @@ -472,7 +472,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { // 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, 'Search found the string.'); + $this->assertText($name, t('Search found the string.')); // Ensure untranslated string doesn't appear if searching on 'only // translated strings'. @@ -483,7 +483,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), "Search didn't find the string."); + $this->assertText(t('No strings available.'), t("Search didn't find the string.")); // Ensure untranslated string appears if searching on 'only untranslated // strings'. @@ -494,7 +494,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), 'Search found the string.'); + $this->assertNoText(t('No strings available.'), t('Search found the string.')); // Add translation. // Assume this is the only result, given the random name. @@ -517,7 +517,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), 'Search found the translation.'); + $this->assertNoText(t('No strings available.'), t('Search found the translation.')); // Ensure translated source string doesn't appear if searching on 'only // untranslated strings'. @@ -528,7 +528,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), "Search didn't find the source string."); + $this->assertText(t('No strings available.'), t("Search didn't find the source string.")); // Ensure translated string doesn't appear if searching on 'only // untranslated strings'. @@ -539,7 +539,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), "Search didn't find the translation."); + $this->assertText(t('No strings available.'), t("Search didn't find the translation.")); // Ensure translated string does appear if searching on the custom language. $search = array( @@ -549,7 +549,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), 'Search found the translation.'); + $this->assertNoText(t('No strings available.'), t('Search found the translation.')); // Ensure translated string doesn't appear if searching on English. $search = array( @@ -559,7 +559,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), "Search didn't find the translation."); + $this->assertText(t('No strings available.'), t("Search didn't find the translation.")); // Search for a string that isn't in the system. $unavailable_string = $this->randomName(16); @@ -570,7 +570,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), "Search didn't find the invalid string."); + $this->assertText(t('No strings available.'), t("Search didn't find the invalid string.")); } } @@ -608,16 +608,16 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { )); // The import should automatically create the corresponding language. - $this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), 'The language has been automatically created.'); + $this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), t('The language has been automatically created.')); // The import should have created 7 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' => 7, '%update' => 0, '%delete' => 0)), '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' => 7, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.')); // This import should have saved plural forms to have 2 variants. - $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 2, 'Plural number initialized.'); + $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 2, t('Plural number initialized.')); // Ensure we were redirected correctly. - $this->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), t('Correct page redirection.')); // Try importing a .po file with invalid tags in the default text group. @@ -626,9 +626,9 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { )); // 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)), '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)), t('The translation file was successfully imported.')); $skip_message = format_plural(2, 'One translation string was skipped because it contains disallowed HTML.', '@count translation strings were skipped because they contain disallowed HTML.'); - $this->assertRaw($skip_message, 'Unsafe strings were skipped.'); + $this->assertRaw($skip_message, t('Unsafe strings were skipped.')); // Try importing a .po file with invalid tags in a non default text group. @@ -638,7 +638,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { )); // The import should have created 3 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' => 3, '%update' => 0, '%delete' => 0)), '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' => 3, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.')); // Try importing a .po file which doesn't exist. @@ -648,8 +648,8 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { 'files[file]' => $name, 'group' => 'custom', ), t('Import')); - $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.'); + $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.')); // Try importing a .po file with overriding strings, and ensure existing @@ -660,7 +660,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { )); // 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)), '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)), t('The translation file was successfully imported.')); // Ensure string wasn't overwritten. $search = array( 'string' => 'Montag', @@ -669,10 +669,10 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), 'String not overwritten by imported string.'); + $this->assertText(t('No strings available.'), t('String not overwritten by imported string.')); // This import should not have changed number of plural forms. - $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 2, 'Plural numbers untouched.'); + $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 2, t('Plural numbers untouched.')); // Try importing a .po file with overriding strings, and ensure existing // strings are overwritten. @@ -682,7 +682,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { )); // 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)), '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)), t('The translation file was successfully imported.')); // Ensure string was overwritten. $search = array( 'string' => 'Montag', @@ -691,9 +691,9 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), 'String overwritten by imported string.'); + $this->assertNoText(t('No strings available.'), t('String overwritten by imported string.')); // This import should have changed number of plural forms. - $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 3, 'Plural numbers changed.'); + $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 3, t('Plural numbers changed.')); } /** @@ -722,7 +722,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { // Ensure the translation file was automatically imported when language was // added. - $this->assertText(t('One translation file imported for the enabled modules.'), 'Language file automatically imported.'); + $this->assertText(t('One translation file imported for the enabled modules.'), t('Language file automatically imported.')); // Ensure strings were successfully imported. $search = array( @@ -732,7 +732,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings available.'), 'String successfully imported.'); + $this->assertNoText(t('No strings available.'), t('String successfully imported.')); } /** @@ -745,8 +745,8 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { 'langcode' => 'hr', )); - $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.'); + $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.')); } /** @@ -919,9 +919,9 @@ class LocaleExportFunctionalTest extends DrupalWebTestCase { ), t('Export')); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal', 'Exported French translation file.'); + $this->assertRaw('# French translation of Drupal', t('Exported French translation file.')); // Ensure our imported translations exist in the file. - $this->assertRaw('msgstr "lundi"', 'French translations present in exported file.'); + $this->assertRaw('msgstr "lundi"', t('French translations present in exported file.')); } /** @@ -934,7 +934,7 @@ class LocaleExportFunctionalTest extends DrupalWebTestCase { // doesn't work. $this->drupalPost('admin/config/regional/translate/export', array(), t('Export')); // Ensure we have a translation file. - $this->assertRaw('# LANGUAGE translation of PROJECT', 'Exported translation template file.'); + $this->assertRaw('# LANGUAGE translation of PROJECT', t('Exported translation template file.')); } /** @@ -982,7 +982,7 @@ class LocaleInstallTest extends DrupalWebTestCase { function testFunctionSignatures() { $reflector_t = new ReflectionFunction('t'); $reflector_st = new ReflectionFunction('st'); - $this->assertEqual($reflector_t->getParameters(), $reflector_st->getParameters(), 'Function signatures of t() and st() are equal.'); + $this->assertEqual($reflector_t->getParameters(), $reflector_st->getParameters(), t('Function signatures of t() and st() are equal.')); } } @@ -1021,7 +1021,7 @@ class LocaleUninstallFunctionalTest extends DrupalWebTestCase { // Check the UI language. drupal_language_initialize(); global $language; - $this->assertEqual($language->language, $this->language, 'Current language: ' . $language->language); + $this->assertEqual($language->language, $this->language, t('Current language: %lang', array('%lang' => $language->language))); // Enable multilingual workflow option for articles. variable_set('language_content_type_article', 1); @@ -1042,7 +1042,7 @@ class LocaleUninstallFunctionalTest extends DrupalWebTestCase { _locale_rebuild_js('fr'); $file = db_query('SELECT javascript FROM {languages} WHERE language = :language', array(':language' => 'fr'))->fetchObject(); $js_file = 'public://' . variable_get('locale_js_directory', 'languages') . '/fr_' . $file->javascript . '.js'; - $this->assertTrue($result = file_exists($js_file), 'JavaScript file created: ' . $result ? $js_file : t('none')); + $this->assertTrue($result = file_exists($js_file), t('JavaScript file created: %file', array('%file' => $result ? $js_file : t('none')))); // Disable string caching. variable_set('locale_cache_strings', 0); @@ -1067,44 +1067,44 @@ class LocaleUninstallFunctionalTest extends DrupalWebTestCase { // Check the init language logic. drupal_language_initialize(); - $this->assertEqual($language->language, 'en', 'Language after uninstall: ' . $language->language); + $this->assertEqual($language->language, 'en', t('Language after uninstall: %lang', array('%lang' => $language->language))); // Check JavaScript files deletion. - $this->assertTrue($result = !file_exists($js_file), 'JavaScript file deleted: ' . $result ? $js_file : t('found')); + $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found')))); // Check language count. $language_count = variable_get('language_count', 1); - $this->assertEqual($language_count, 1, 'Language count: ' . $language_count); + $this->assertEqual($language_count, 1, t('Language count: %count', array('%count' => $language_count))); // Check language negotiation. require_once DRUPAL_ROOT . '/includes/language.inc'; - $this->assertTrue(count(language_types()) == count(drupal_language_types()), 'Language types reset'); + $this->assertTrue(count(language_types()) == count(drupal_language_types()), t('Language types reset')); $language_negotiation = language_negotiation_get(LANGUAGE_TYPE_INTERFACE) == LANGUAGE_NEGOTIATION_DEFAULT; - $this->assertTrue($language_negotiation, 'Interface language negotiation: ' . t($language_negotiation ? 'none' : 'set')); + $this->assertTrue($language_negotiation, t('Interface language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set')))); $language_negotiation = language_negotiation_get(LANGUAGE_TYPE_CONTENT) == LANGUAGE_NEGOTIATION_DEFAULT; - $this->assertTrue($language_negotiation, 'Content language negotiation: ' . t($language_negotiation ? 'none' : 'set')); + $this->assertTrue($language_negotiation, t('Content language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set')))); $language_negotiation = language_negotiation_get(LANGUAGE_TYPE_URL) == LANGUAGE_NEGOTIATION_DEFAULT; - $this->assertTrue($language_negotiation, 'URL language negotiation: ' . t($language_negotiation ? 'none' : 'set')); + $this->assertTrue($language_negotiation, t('URL language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set')))); // Check language providers settings. - $this->assertFalse(variable_get('locale_language_negotiation_url_part', FALSE), 'URL language provider indicator settings cleared.'); - $this->assertFalse(variable_get('locale_language_negotiation_session_param', FALSE), 'Visit language provider settings cleared.'); + $this->assertFalse(variable_get('locale_language_negotiation_url_part', FALSE), t('URL language provider indicator settings cleared.')); + $this->assertFalse(variable_get('locale_language_negotiation_session_param', FALSE), t('Visit language provider settings cleared.')); // Check JavaScript parsed. $javascript_parsed_count = count(variable_get('javascript_parsed', array())); - $this->assertEqual($javascript_parsed_count, 0, 'JavaScript parsed count: ' . $javascript_parsed_count); + $this->assertEqual($javascript_parsed_count, 0, t('JavaScript parsed count: %count', array('%count' => $javascript_parsed_count))); // Check multilingual workflow option for articles. $multilingual = variable_get('language_content_type_article', 0); - $this->assertEqual($multilingual, 0, 'Multilingual workflow option: ' . t($multilingual ? 'enabled' : 'disabled')); + $this->assertEqual($multilingual, 0, t('Multilingual workflow option: %status', array('%status' => t($multilingual ? 'enabled': 'disabled')))); // Check JavaScript translations directory. $locale_js_directory = variable_get('locale_js_directory', 'languages'); - $this->assertEqual($locale_js_directory, 'languages', 'JavaScript translations directory: ' . $locale_js_directory); + $this->assertEqual($locale_js_directory, 'languages', t('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, 'String caching: ' . t($locale_cache_strings ? 'enabled' : 'disabled')); + $this->assertEqual($locale_cache_strings, 1, t('String caching: %status', array('%status' => t($locale_cache_strings ? 'enabled': 'disabled')))); } } @@ -1177,7 +1177,7 @@ class LocaleLanguageSwitchingFunctionalTest extends DrupalWebTestCase { // Assert that the language switching block is displayed on the frontpage. $this->drupalGet(''); - $this->assertText(t('Languages'), 'Language switcher block found.'); + $this->assertText(t('Languages'), t('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-locale-' . $language_type)); @@ -1206,8 +1206,8 @@ class LocaleLanguageSwitchingFunctionalTest extends DrupalWebTestCase { $anchors['inactive'][] = $language; } } - $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.'); + $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.')); } } @@ -1286,21 +1286,21 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase { $path = 'user/' . $web_user->uid . '/edit'; $this->drupalGet($path); // Ensure language settings fieldset is available. - $this->assertText(t('Language settings'), 'Language settings available.'); + $this->assertText(t('Language settings'), t('Language settings available.')); // Ensure custom language is present. - $this->assertText($name, 'Language present on form.'); + $this->assertText($name, t('Language present on form.')); // Ensure disabled language isn't present. - $this->assertNoText($name_disabled, 'Disabled language not present on form.'); + $this->assertNoText($name_disabled, t('Disabled language not present on form.')); // Switch to our custom language. $edit = array( 'language' => $langcode, ); $this->drupalPost($path, $edit, t('Save')); // Ensure form was submitted successfully. - $this->assertText(t('The changes have been saved.'), 'Changes were saved.'); + $this->assertText(t('The changes have been saved.'), t('Changes were saved.')); // Check if language was changed. $elements = $this->xpath('//input[@id=:id]', array(':id' => 'edit-language-' . $langcode)); - $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), 'Default language successfully updated.'); + $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), t('Default language successfully updated.')); $this->drupalLogout(); } @@ -1338,20 +1338,20 @@ class LocaleUserCreationTest extends DrupalWebTestCase { 'langcode' => 'fr', ); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language')); - $this->assertText($langcode, 'Language added successfully.'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertText($langcode, t('Language added successfully.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.')); // Set language negotiation. $edit = array( 'language[enabled][locale-url]' => TRUE, ); $this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings')); - $this->assertText(t('Language negotiation configuration saved.'), 'Set language negotiation.'); + $this->assertText(t('Language negotiation configuration saved.'), t('Set language negotiation.')); // Check if the language selector is available on admin/people/create and // set to the currently active language. $this->drupalGet($langcode . '/admin/people/create'); - $this->assertFieldChecked("edit-language-$langcode", 'Global language set in the language selector.'); + $this->assertFieldChecked("edit-language-$langcode", t('Global language set in the language selector.')); // Create a user with the admin/people/create form and check if the correct // language is set. @@ -1366,7 +1366,7 @@ class LocaleUserCreationTest extends DrupalWebTestCase { $this->drupalPost($langcode . '/admin/people/create', $edit, t('Create new account')); $user = user_load_by_name($username); - $this->assertEqual($user->language, $langcode, 'New user has correct language set.'); + $this->assertEqual($user->language, $langcode, t('New user has correct language set.')); // Register a new user and check if the language selector is hidden. $this->drupalLogout(); @@ -1383,7 +1383,7 @@ class LocaleUserCreationTest extends DrupalWebTestCase { $this->drupalPost($langcode . '/user/register', $edit, t('Create new account')); $user = user_load_by_name($username); - $this->assertEqual($user->language, $langcode, 'New user has correct language set.'); + $this->assertEqual($user->language, $langcode, t('New user has correct language set.')); // Test if the admin can use the language selector and if the // correct language is was saved. @@ -1391,7 +1391,7 @@ class LocaleUserCreationTest extends DrupalWebTestCase { $this->drupalLogin($admin_user); $this->drupalGet($user_edit); - $this->assertFieldChecked("edit-language-$langcode", 'Language selector is accessible and correct language is selected.'); + $this->assertFieldChecked("edit-language-$langcode", t('Language selector is accessible and correct language is selected.')); // Set pass_raw so we can login the new user. $user->pass_raw = $this->randomName(10); @@ -1404,7 +1404,7 @@ class LocaleUserCreationTest extends DrupalWebTestCase { $this->drupalLogin($user); $this->drupalGet($user_edit); - $this->assertFieldChecked("edit-language-$langcode", 'Language selector is accessible and correct language is selected.'); + $this->assertFieldChecked("edit-language-$langcode", t('Language selector is accessible and correct language is selected.')); } } @@ -1480,11 +1480,11 @@ class LocalePathFunctionalTest extends DrupalWebTestCase { // Confirm English language path alias works. $this->drupalGet($english_path); - $this->assertText($node->title, 'English alias works.'); + $this->assertText($node->title, t('English alias works.')); // Confirm custom language path alias works. $this->drupalGet($prefix . '/' . $custom_language_path); - $this->assertText($node->title, 'Custom language alias works.'); + $this->assertText($node->title, t('Custom language alias works.')); $this->drupalLogout(); } @@ -1563,28 +1563,28 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase { // Set "Basic page" content type to use multilingual support. $this->drupalGet('admin/structure/types/manage/page'); - $this->assertText(t('Multilingual support'), 'Multilingual support fieldset present on content type configuration form.'); + $this->assertText(t('Multilingual support'), t('Multilingual support fieldset present on content type configuration form.')); $edit = array( 'language_content_type' => 1, ); $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')), 'Basic page content type has been updated.'); + $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), t('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', '', 'Language select not present on add article form.'); + $this->assertNoFieldByName('language', '', t('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('language', '', 'Language select present on add Basic page form.'); + $this->assertFieldByName('language', '', t('Language select present on add Basic page form.')); // Ensure enabled language appears. - $this->assertText($name, 'Enabled language present.'); + $this->assertText($name, t('Enabled language present.')); // Ensure disabled language doesn't appear. - $this->assertNoText($name_disabled, 'Disabled language not present.'); + $this->assertNoText($name_disabled, t('Disabled language not present.')); // Create "Basic page" content. $node_title = $this->randomName(); @@ -1599,13 +1599,13 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase { // Edit the content and ensure correct language is selected. $path = 'node/' . $node->nid . '/edit'; $this->drupalGet($path); - $this->assertRaw('<option value="' . $langcode . '" selected="selected">' . $name . '</option>', 'Correct language selected.'); + $this->assertRaw('<option value="' . $langcode . '" selected="selected">' . $name . '</option>', t('Correct language selected.')); // Ensure we can change the node language. $edit = array( 'language' => 'en', ); $this->drupalPost($path, $edit, t('Save')); - $this->assertRaw(t('%title has been updated.', array('%title' => $node_title)), 'Basic page content updated.'); + $this->assertRaw(t('%title has been updated.', array('%title' => $node_title)), t('Basic page content updated.')); $this->drupalLogout(); } @@ -1698,7 +1698,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase { $language_browser_fallback_string = "In $language_browser_fallback In $language_browser_fallback In $language_browser_fallback"; $language_string = "In $language In $language In $language"; // Do a translate search of our target string. - $edit = array('string' => $default_string); + $edit = array( 'string' => $default_string); $this->drupalPost('admin/config/regional/translate/translate', $edit, t('Filter')); // Should find the string and now click edit to post translated string. $this->clickLink('edit'); @@ -1840,7 +1840,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase { 'language_content_type' => 1, ); $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')), 'Basic page content type has been updated.'); + $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), t('Basic page content type has been updated.')); } /** @@ -1863,10 +1863,10 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase { // Check that the node exists in the database. $node = $this->drupalGetNodeByTitle($edit[$title_key]); - $this->assertTrue($node, 'Node found in database.'); + $this->assertTrue($node, t('Node found in database.')); $assert = isset($node->body['en']) && !isset($node->body[LANGUAGE_NONE]) && $node->body['en'][0]['value'] == $body_value; - $this->assertTrue($assert, 'Field language correctly set.'); + $this->assertTrue($assert, t('Field language correctly set.')); // Change node language. $this->drupalGet("node/$node->nid/edit"); @@ -1876,20 +1876,20 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase { ); $this->drupalPost(NULL, $edit, t('Save')); $node = $this->drupalGetNodeByTitle($edit[$title_key]); - $this->assertTrue($node, 'Node found in database.'); + $this->assertTrue($node, t('Node found in database.')); $assert = isset($node->body['it']) && !isset($node->body['en']) && $node->body['it'][0]['value'] == $body_value; - $this->assertTrue($assert, 'Field language correctly changed.'); + $this->assertTrue($assert, t('Field language correctly changed.')); // Enable content language URL detection. language_negotiation_set(LANGUAGE_TYPE_CONTENT, array(LOCALE_LANGUAGE_NEGOTIATION_URL => 0)); // Test multilingual field language fallback logic. $this->drupalGet("it/node/$node->nid"); - $this->assertRaw($body_value, 'Body correctly displayed using Italian as requested language'); + $this->assertRaw($body_value, t('Body correctly displayed using Italian as requested language')); $this->drupalGet("node/$node->nid"); - $this->assertRaw($body_value, 'Body correctly displayed using English as requested language'); + $this->assertRaw($body_value, t('Body correctly displayed using English as requested language')); } /* @@ -1912,7 +1912,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase { // Check that the node exists in the database. $node = $this->drupalGetNodeByTitle($edit[$title_key]); - $this->assertTrue($node, 'Node found in database.'); + $this->assertTrue($node, t('Node found in database.')); // Check if node body is showed. $this->drupalGet("node/$node->nid"); @@ -1983,10 +1983,10 @@ class LocaleDateFormatsFunctionalTest extends DrupalWebTestCase { // Configure format for the node posted date changes with the language. $this->drupalGet('node/' . $node->nid); $english_date = format_date($node->created, 'custom', 'j M Y'); - $this->assertText($english_date, 'English date format appears'); + $this->assertText($english_date, t('English date format appears')); $this->drupalGet('fr/node/' . $node->nid); $french_date = format_date($node->created, 'custom', 'd.m.Y'); - $this->assertText($french_date, 'French date format appears'); + $this->assertText($french_date, t('French date format appears')); } } |