Commit 497ebcd2 authored by xjm's avatar xjm

Issue #2506445 by joelpittet, Ryan Weal, Sutharsan, alexpott, subhojit777,...

Issue #2506445 by joelpittet, Ryan Weal, Sutharsan, alexpott, subhojit777, justAChris, nlisgo, effulgentsia, rpayanm, larowlan, chx, xjm, dawehner, geertvd, lauriii, izus, andypost, borisson_, Sharique: Replace !placeholder with @placeholder in t() and format_string() for non-URLs in tests
parent 98be22d2
...@@ -40,7 +40,7 @@ public function testUpdateFeedItem() { ...@@ -40,7 +40,7 @@ public function testUpdateFeedItem() {
$this->assertResponse(200); $this->assertResponse(200);
$this->drupalPostForm('aggregator/sources/add', $edit, t('Save')); $this->drupalPostForm('aggregator/sources/add', $edit, t('Save'));
$this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title[0][value]'])), format_string('The feed !name has been added.', array('!name' => $edit['title[0][value]']))); $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title[0][value]'])), format_string('The feed @name has been added.', array('@name' => $edit['title[0][value]'])));
$fid = db_query("SELECT fid FROM {aggregator_feed} WHERE url = :url", array(':url' => $edit['url[0][value]']))->fetchField(); $fid = db_query("SELECT fid FROM {aggregator_feed} WHERE url = :url", array(':url' => $edit['url[0][value]']))->fetchField();
$feed = Feed::load($fid); $feed = Feed::load($fid);
...@@ -62,7 +62,7 @@ public function testUpdateFeedItem() { ...@@ -62,7 +62,7 @@ public function testUpdateFeedItem() {
$feed->refreshItems(); $feed->refreshItems();
$after = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchField(); $after = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchField();
$this->assertTrue($before === $after, format_string('Publish timestamp of feed item was not updated (!before === !after)', array('!before' => $before, '!after' => $after))); $this->assertTrue($before === $after, format_string('Publish timestamp of feed item was not updated (@before === @after)', array('@before' => $before, '@after' => $after)));
// Make sure updating items works even after uninstalling a module // Make sure updating items works even after uninstalling a module
// that provides the selected plugins. // that provides the selected plugins.
......
...@@ -48,8 +48,8 @@ public function testBlockContentCreation() { ...@@ -48,8 +48,8 @@ public function testBlockContentCreation() {
$this->drupalPostForm('block/add/basic', $edit, t('Save')); $this->drupalPostForm('block/add/basic', $edit, t('Save'));
// Check that the Basic block has been created. // Check that the Basic block has been created.
$this->assertRaw(format_string('!block %name has been created.', array( $this->assertRaw(format_string('@block %name has been created.', array(
'!block' => 'basic', '@block' => 'basic',
'%name' => $edit['info[0][value]'] '%name' => $edit['info[0][value]']
)), 'Basic block created.'); )), 'Basic block created.');
...@@ -95,8 +95,8 @@ public function testBlockContentCreationMultipleViewModes() { ...@@ -95,8 +95,8 @@ public function testBlockContentCreationMultipleViewModes() {
$this->drupalPostForm('block/add/basic', $edit, t('Save')); $this->drupalPostForm('block/add/basic', $edit, t('Save'));
// Check that the Basic block has been created. // Check that the Basic block has been created.
$this->assertRaw(format_string('!block %name has been created.', array( $this->assertRaw(format_string('@block %name has been created.', array(
'!block' => 'basic', '@block' => 'basic',
'%name' => $edit['info[0][value]'] '%name' => $edit['info[0][value]']
)), 'Basic block created.'); )), 'Basic block created.');
...@@ -144,8 +144,8 @@ public function testDefaultBlockContentCreation() { ...@@ -144,8 +144,8 @@ public function testDefaultBlockContentCreation() {
$this->drupalPostForm('block/add', $edit, t('Save')); $this->drupalPostForm('block/add', $edit, t('Save'));
// Check that the block has been created and that it is a basic block. // Check that the block has been created and that it is a basic block.
$this->assertRaw(format_string('!block %name has been created.', array( $this->assertRaw(format_string('@block %name has been created.', array(
'!block' => 'basic', '@block' => 'basic',
'%name' => $edit['info[0][value]'], '%name' => $edit['info[0][value]'],
)), 'Basic block created.'); )), 'Basic block created.');
......
...@@ -69,8 +69,8 @@ public function testRevisions() { ...@@ -69,8 +69,8 @@ public function testRevisions() {
// Confirm the correct revision text appears. // Confirm the correct revision text appears.
$loaded = entity_revision_load('block_content', $revision_id); $loaded = entity_revision_load('block_content', $revision_id);
// Verify revision log is the same. // Verify revision log is the same.
$this->assertEqual($loaded->getRevisionLog(), $logs[$delta], format_string('Correct log message found for revision !revision', array( $this->assertEqual($loaded->getRevisionLog(), $logs[$delta], format_string('Correct log message found for revision @revision', array(
'!revision' => $loaded->getRevisionId(), '@revision' => $loaded->getRevisionId(),
))); )));
} }
......
...@@ -64,7 +64,7 @@ public function testPageEdit() { ...@@ -64,7 +64,7 @@ public function testPageEdit() {
// Test deleting the block. // Test deleting the block.
$this->drupalGet("block/" . $revised_block->id()); $this->drupalGet("block/" . $revised_block->id());
$this->clickLink(t('Delete')); $this->clickLink(t('Delete'));
$this->assertText(format_string('Are you sure you want to delete the custom block !label?', array('!label' => $revised_block->label()))); $this->assertText(format_string('Are you sure you want to delete the custom block @label?', array('@label' => $revised_block->label())));
} }
} }
...@@ -273,8 +273,8 @@ public function testExportImportCollections() { ...@@ -273,8 +273,8 @@ public function testExportImportCollections() {
// Verify that there are configuration differences to import. // Verify that there are configuration differences to import.
$this->drupalGet('admin/config/development/configuration'); $this->drupalGet('admin/config/development/configuration');
$this->assertNoText(t('There are no configuration changes to import.')); $this->assertNoText(t('There are no configuration changes to import.'));
$this->assertText(t('!collection configuration collection', array('!collection' => 'collection.test1'))); $this->assertText(t('@collection configuration collection', array('@collection' => 'collection.test1')));
$this->assertText(t('!collection configuration collection', array('!collection' => 'collection.test2'))); $this->assertText(t('@collection configuration collection', array('@collection' => 'collection.test2')));
$this->assertText('config_test.create'); $this->assertText('config_test.create');
$this->assertLinkByHref('admin/config/development/configuration/sync/diff_collection/collection.test1/config_test.create'); $this->assertLinkByHref('admin/config/development/configuration/sync/diff_collection/collection.test1/config_test.create');
$this->assertText('config_test.update'); $this->assertText('config_test.update');
......
...@@ -116,7 +116,7 @@ public function testMapperListPage() { ...@@ -116,7 +116,7 @@ public function testMapperListPage() {
$entity_type = \Drupal::entityManager()->getDefinition($test_entity->getEntityTypeId()); $entity_type = \Drupal::entityManager()->getDefinition($test_entity->getEntityTypeId());
$this->drupalGet($base_url . '/translate'); $this->drupalGet($base_url . '/translate');
$title = t('!label !entity_type', array('!label' => $test_entity->label(), '!entity_type' => $entity_type->getLowercaseLabel())); $title = t('@label @entity_type', array('@label' => $test_entity->label(), '@entity_type' => $entity_type->getLowercaseLabel()));
$title = t('Translations for %label', array('%label' => $title)); $title = t('Translations for %label', array('%label' => $title));
$this->assertRaw($title); $this->assertRaw($title);
$this->assertRaw('<th>' . t('Language') . '</th>'); $this->assertRaw('<th>' . t('Language') . '</th>');
......
...@@ -370,7 +370,7 @@ public function testContactConfigEntityTranslation() { ...@@ -370,7 +370,7 @@ public function testContactConfigEntityTranslation() {
// Test that delete links work and operations perform properly. // Test that delete links work and operations perform properly.
foreach ($this->langcodes as $langcode) { foreach ($this->langcodes as $langcode) {
$replacements = array('%label' => t('!label !entity_type', array('!label' => $label, '!entity_type' => Unicode::strtolower(t('Contact form')))), '@language' => \Drupal::languageManager()->getLanguage($langcode)->getName()); $replacements = array('%label' => t('@label @entity_type', array('@label' => $label, '@entity_type' => Unicode::strtolower(t('Contact form')))), '@language' => \Drupal::languageManager()->getLanguage($langcode)->getName());
$this->drupalGet("$translation_base_url/$langcode/delete"); $this->drupalGet("$translation_base_url/$langcode/delete");
$this->assertRaw(t('Are you sure you want to delete the @language translation of %label?', $replacements)); $this->assertRaw(t('Are you sure you want to delete the @language translation of %label?', $replacements));
......
...@@ -129,7 +129,7 @@ function testSiteWideContact() { ...@@ -129,7 +129,7 @@ function testSiteWideContact() {
$max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH; $max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH;
$max_length_exceeded = $max_length + 1; $max_length_exceeded = $max_length + 1;
$this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE); $this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE);
$this->assertText(format_string('Machine-readable name cannot be longer than !max characters but is currently !exceeded characters long.', array('!max' => $max_length, '!exceeded' => $max_length_exceeded))); $this->assertText(format_string('Machine-readable name cannot be longer than @max characters but is currently @exceeded characters long.', array('@max' => $max_length, '@exceeded' => $max_length_exceeded)));
$this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', array($recipients[0])), '', TRUE); $this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', array($recipients[0])), '', TRUE);
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label))); $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
......
...@@ -208,7 +208,7 @@ function testFieldFormSingleRequired() { ...@@ -208,7 +208,7 @@ function testFieldFormSingleRequired() {
// Submit with missing required value. // Submit with missing required value.
$edit = array(); $edit = array();
$this->drupalPostForm('entity_test/add', $edit, t('Save')); $this->drupalPostForm('entity_test/add', $edit, t('Save'));
$this->assertRaw(t('!name field is required.', array('!name' => $this->field['label'])), 'Required field with no value fails validation'); $this->assertRaw(t('@name field is required.', array('@name' => $this->field['label'])), 'Required field with no value fails validation');
// Create an entity // Create an entity
$value = mt_rand(1, 127); $value = mt_rand(1, 127);
...@@ -228,7 +228,7 @@ function testFieldFormSingleRequired() { ...@@ -228,7 +228,7 @@ function testFieldFormSingleRequired() {
"{$field_name}[0][value]" => $value, "{$field_name}[0][value]" => $value,
); );
$this->drupalPostForm('entity_test/manage/' . $id, $edit, t('Save')); $this->drupalPostForm('entity_test/manage/' . $id, $edit, t('Save'));
$this->assertRaw(t('!name field is required.', array('!name' => $this->field['label'])), 'Required field with no value fails validation'); $this->assertRaw(t('@name field is required.', array('@name' => $this->field['label'])), 'Required field with no value fails validation');
} }
// function testFieldFormMultiple() { // function testFieldFormMultiple() {
......
...@@ -81,7 +81,7 @@ function _testTextfieldWidgets($field_type, $widget_type) { ...@@ -81,7 +81,7 @@ function _testTextfieldWidgets($field_type, $widget_type) {
$this->drupalGet('entity_test/add'); $this->drupalGet('entity_test/add');
$this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed'); $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed');
$this->assertNoFieldByName("{$field_name}[0][format]", '1', 'Format selector is not displayed'); $this->assertNoFieldByName("{$field_name}[0][format]", '1', 'Format selector is not displayed');
$this->assertRaw(format_string('placeholder="A placeholder on !widget_type"', array('!widget_type' => $widget_type))); $this->assertRaw(format_string('placeholder="A placeholder on @widget_type"', array('@widget_type' => $widget_type)));
// Submit with some value. // Submit with some value.
$value = $this->randomMachineName(); $value = $this->randomMachineName();
......
...@@ -220,7 +220,7 @@ function testHandleDangerousFile() { ...@@ -220,7 +220,7 @@ function testHandleDangerousFile() {
$this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.'); $this->assertResponse(200, 'Received a 200 response for posted test file.');
$this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.'); $this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.');
$this->assertRaw(t('File name is !filename', array('!filename' => $this->phpfile->filename)), 'Dangerous file was not renamed when insecure uploads is TRUE.'); $this->assertRaw(t('File name is @filename', array('@filename' => $this->phpfile->filename)), 'Dangerous file was not renamed when insecure uploads is TRUE.');
$this->assertRaw(t('You WIN!'), 'Found the success message.'); $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called. // Check that the correct hooks were called.
...@@ -254,7 +254,7 @@ function testHandleFileMunge() { ...@@ -254,7 +254,7 @@ function testHandleFileMunge() {
$this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.'); $this->assertResponse(200, 'Received a 200 response for posted test file.');
$this->assertRaw(t('For security reasons, your upload has been renamed'), 'Found security message.'); $this->assertRaw(t('For security reasons, your upload has been renamed'), 'Found security message.');
$this->assertRaw(t('File name is !filename', array('!filename' => $munged_filename)), 'File was successfully munged.'); $this->assertRaw(t('File name is @filename', array('@filename' => $munged_filename)), 'File was successfully munged.');
$this->assertRaw(t('You WIN!'), 'Found the success message.'); $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called. // Check that the correct hooks were called.
...@@ -272,7 +272,7 @@ function testHandleFileMunge() { ...@@ -272,7 +272,7 @@ function testHandleFileMunge() {
$this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.'); $this->assertResponse(200, 'Received a 200 response for posted test file.');
$this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.'); $this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.');
$this->assertRaw(t('File name is !filename', array('!filename' => $this->image->getFilename())), 'File was not munged when allowing any extension.'); $this->assertRaw(t('File name is @filename', array('@filename' => $this->image->getFilename())), 'File was not munged when allowing any extension.');
$this->assertRaw(t('You WIN!'), 'Found the success message.'); $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called. // Check that the correct hooks were called.
......
...@@ -280,7 +280,7 @@ function testFormatWidgetPermissions() { ...@@ -280,7 +280,7 @@ function testFormatWidgetPermissions() {
$edit = array(); $edit = array();
$edit['title[0][value]'] = $new_title; $edit['title[0][value]'] = $new_title;
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->assertText(t('!name field is required.', array('!name' => t('Text format'))), 'Error message is displayed.'); $this->assertText(t('@name field is required.', array('@name' => t('Text format'))), 'Error message is displayed.');
$this->drupalGet('node/' . $node->id()); $this->drupalGet('node/' . $node->id());
$this->assertText($old_title, 'Old title found.'); $this->assertText($old_title, 'Old title found.');
$this->assertNoText($new_title, 'New title not found.'); $this->assertNoText($new_title, 'New title not found.');
...@@ -315,7 +315,7 @@ function testFormatWidgetPermissions() { ...@@ -315,7 +315,7 @@ function testFormatWidgetPermissions() {
$edit = array(); $edit = array();
$edit['title[0][value]'] = $new_title; $edit['title[0][value]'] = $new_title;
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->assertText(t('!name field is required.', array('!name' => t('Text format'))), 'Error message is displayed.'); $this->assertText(t('@name field is required.', array('@name' => t('Text format'))), 'Error message is displayed.');
$this->drupalGet('node/' . $node->id()); $this->drupalGet('node/' . $node->id());
$this->assertText($old_title, 'Old title found.'); $this->assertText($old_title, 'Old title found.');
$this->assertNoText($new_title, 'New title not found.'); $this->assertNoText($new_title, 'New title not found.');
......
...@@ -40,8 +40,8 @@ public function testLanguageConfiguration() { ...@@ -40,8 +40,8 @@ public function testLanguageConfiguration() {
); );
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
// Test validation on missing values. // Test validation on missing values.
$this->assertText(t('!name field is required.', array('!name' => t('Language code')))); $this->assertText(t('@name field is required.', array('@name' => t('Language code'))));
$this->assertText(t('!name field is required.', array('!name' => t('Language name')))); $this->assertText(t('@name field is required.', array('@name' => t('Language name'))));
$empty_language = new Language(); $empty_language = new Language();
$this->assertFieldChecked('edit-direction-' . $empty_language->getDirection(), 'Consistent usage of language direction.'); $this->assertFieldChecked('edit-direction-' . $empty_language->getDirection(), 'Consistent usage of language direction.');
$this->assertUrl(\Drupal::url('language.add', array(), array('absolute' => TRUE)), [], 'Correct page redirection.'); $this->assertUrl(\Drupal::url('language.add', array(), array('absolute' => TRUE)), [], 'Correct page redirection.');
......
...@@ -277,14 +277,14 @@ function testLinkTitle() { ...@@ -277,14 +277,14 @@ function testLinkTitle() {
"{$field_name}[0][uri]" => 'http://www.example.com', "{$field_name}[0][uri]" => 'http://www.example.com',
); );
$this->drupalPostForm(NULL, $edit, t('Save')); $this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertText(t('!name field is required.', array('!name' => t('Link text')))); $this->assertText(t('@name field is required.', array('@name' => t('Link text'))));
// Verify that the link text is not required, if the URL is empty. // Verify that the link text is not required, if the URL is empty.
$edit = array( $edit = array(
"{$field_name}[0][uri]" => '', "{$field_name}[0][uri]" => '',
); );
$this->drupalPostForm(NULL, $edit, t('Save')); $this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertNoText(t('!name field is required.', array('!name' => t('Link text')))); $this->assertNoText(t('@name field is required.', array('@name' => t('Link text'))));
// Verify that a URL and link text meets requirements. // Verify that a URL and link text meets requirements.
$this->drupalGet('entity_test/add'); $this->drupalGet('entity_test/add');
...@@ -293,7 +293,7 @@ function testLinkTitle() { ...@@ -293,7 +293,7 @@ function testLinkTitle() {
"{$field_name}[0][title]" => 'Example', "{$field_name}[0][title]" => 'Example',
); );
$this->drupalPostForm(NULL, $edit, t('Save')); $this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertNoText(t('!name field is required.', array('!name' => t('Link text')))); $this->assertNoText(t('@name field is required.', array('@name' => t('Link text'))));
} }
} }
} }
......
...@@ -111,7 +111,7 @@ public function testInterface() { ...@@ -111,7 +111,7 @@ public function testInterface() {
// Check if translations are available for Drupal core. // Check if translations are available for Drupal core.
$this->drupalGet('admin/reports/translations'); $this->drupalGet('admin/reports/translations');
$this->assertText(t('Updates for: !project', array('!project' => t('Drupal core'))), 'Translations found'); $this->assertText(t('Updates for: @project', array('@project' => t('Drupal core'))), 'Translations found');
$this->assertText(SafeMarkup::format('@module (@date)', array('@module' => t('Drupal core'), '@date' => format_date(REQUEST_TIME, 'html_date'))), 'Core translation update'); $this->assertText(SafeMarkup::format('@module (@date)', array('@module' => t('Drupal core'), '@date' => format_date(REQUEST_TIME, 'html_date'))), 'Core translation update');
$update_button = $this->xpath('//input[@type="submit"][@value="' . t('Update translations') . '"]'); $update_button = $this->xpath('//input[@type="submit"][@value="' . t('Update translations') . '"]');
$this->assertTrue($update_button, 'Update translations button'); $this->assertTrue($update_button, 'Update translations button');
......
...@@ -195,8 +195,8 @@ function addCustomMenu() { ...@@ -195,8 +195,8 @@ function addCustomMenu() {
// Verify that using a menu_name that is too long results in a validation // Verify that using a menu_name that is too long results in a validation
// message. // message.
$this->assertRaw(t('!name cannot be longer than %max characters but is currently %length characters long.', array( $this->assertRaw(t('@name cannot be longer than %max characters but is currently %length characters long.', array(
'!name' => t('Menu name'), '@name' => t('Menu name'),
'%max' => MENU_MAX_MENU_NAME_LENGTH_UI, '%max' => MENU_MAX_MENU_NAME_LENGTH_UI,
'%length' => Unicode::strlen($menu_name), '%length' => Unicode::strlen($menu_name),
))); )));
...@@ -207,8 +207,8 @@ function addCustomMenu() { ...@@ -207,8 +207,8 @@ function addCustomMenu() {
$this->drupalPostForm('admin/structure/menu/add', $edit, t('Save')); $this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
// Verify that no validation error is given for menu_name length. // Verify that no validation error is given for menu_name length.
$this->assertNoRaw(t('!name cannot be longer than %max characters but is currently %length characters long.', array( $this->assertNoRaw(t('@name cannot be longer than %max characters but is currently %length characters long.', array(
'!name' => t('Menu name'), '@name' => t('Menu name'),
'%max' => MENU_MAX_MENU_NAME_LENGTH_UI, '%max' => MENU_MAX_MENU_NAME_LENGTH_UI,
'%length' => Unicode::strlen($menu_name), '%length' => Unicode::strlen($menu_name),
))); )));
......
...@@ -52,7 +52,7 @@ function testNodeCreation() { ...@@ -52,7 +52,7 @@ function testNodeCreation() {
$this->drupalPostForm('node/add/page', $edit, t('Save')); $this->drupalPostForm('node/add/page', $edit, t('Save'));
// Check that the Basic page has been created. // Check that the Basic page has been created.
$this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit['title[0][value]'])), 'Basic page created.'); $this->assertRaw(t('@post %title has been created.', array('@post' => 'Basic page', '%title' => $edit['title[0][value]'])), 'Basic page created.');
// Check that the node exists in the database. // Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']); $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
...@@ -141,7 +141,7 @@ function testUnpublishedNodeCreation() { ...@@ -141,7 +141,7 @@ function testUnpublishedNodeCreation() {
$this->assertText(t('Test page text')); $this->assertText(t('Test page text'));
// Confirm that the node was created. // Confirm that the node was created.
$this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit['title[0][value]']))); $this->assertRaw(t('@post %title has been created.', array('@post' => 'Basic page', '%title' => $edit['title[0][value]'])));
} }
/** /**
......
...@@ -45,16 +45,16 @@ function testNodeRSSContent() { ...@@ -45,16 +45,16 @@ function testNodeRSSContent() {
$this->drupalGet('rss.xml'); $this->drupalGet('rss.xml');
// Check that content added in 'rss' view mode appear in RSS feed. // Check that content added in 'rss' view mode appear in RSS feed.
$rss_only_content = t('Extra data that should appear only in the RSS feed for node !nid.', array('!nid' => $node->id())); $rss_only_content = t('Extra data that should appear only in the RSS feed for node @nid.', array('@nid' => $node->id()));
$this->assertText($rss_only_content, 'Node content designated for RSS appear in RSS feed.'); $this->assertText($rss_only_content, 'Node content designated for RSS appear in RSS feed.');
// Check that content added in view modes other than 'rss' doesn't // Check that content added in view modes other than 'rss' doesn't
// appear in RSS feed. // appear in RSS feed.
$non_rss_content = t('Extra data that should appear everywhere except the RSS feed for node !nid.', array('!nid' => $node->id())); $non_rss_content = t('Extra data that should appear everywhere except the RSS feed for node @nid.', array('@nid' => $node->id()));
$this->assertNoText($non_rss_content, 'Node content not designed for RSS does not appear in RSS feed.'); $this->assertNoText($non_rss_content, 'Node content not designed for RSS does not appear in RSS feed.');
// Check that extra RSS elements and namespaces are added to RSS feed. // Check that extra RSS elements and namespaces are added to RSS feed.
$test_element = '<testElement>' . t('Value of testElement RSS element for node !nid.', array('!nid' => $node->id())) . '</testElement>'; $test_element = '<testElement>' . t('Value of testElement RSS element for node @nid.', array('@nid' => $node->id())) . '</testElement>';
$test_ns = 'xmlns:drupaltest="http://example.com/test-namespace"'; $test_ns = 'xmlns:drupaltest="http://example.com/test-namespace"';
$this->assertRaw($test_element, 'Extra RSS elements appear in RSS feed.'); $this->assertRaw($test_element, 'Extra RSS elements appear in RSS feed.');
$this->assertRaw($test_ns, 'Extra namespaces appear in RSS feed.'); $this->assertRaw($test_ns, 'Extra namespaces appear in RSS feed.');
......
...@@ -20,12 +20,12 @@ function node_test_node_view(array &$build, NodeInterface $node, EntityViewDispl ...@@ -20,12 +20,12 @@ function node_test_node_view(array &$build, NodeInterface $node, EntityViewDispl
// Add RSS elements and namespaces when building the RSS feed. // Add RSS elements and namespaces when building the RSS feed.
$node->rss_elements[] = array( $node->rss_elements[] = array(
'key' => 'testElement', 'key' => 'testElement',
'value' => t('Value of testElement RSS element for node !nid.', array('!nid' => $node->id())), 'value' => t('Value of testElement RSS element for node @nid.', array('@nid' => $node->id())),
); );
// Add content that should be displayed only in the RSS feed. // Add content that should be displayed only in the RSS feed.
$build['extra_feed_content'] = array( $build['extra_feed_content'] = array(
'#markup' => '<p>' . t('Extra data that should appear only in the RSS feed for node !nid.', array('!nid' => $node->id())) . '</p>', '#markup' => '<p>' . t('Extra data that should appear only in the RSS feed for node @nid.', array('@nid' => $node->id())) . '</p>',
'#weight' => 10, '#weight' => 10,
); );
} }
...@@ -33,7 +33,7 @@ function node_test_node_view(array &$build, NodeInterface $node, EntityViewDispl ...@@ -33,7 +33,7 @@ function node_test_node_view(array &$build, NodeInterface $node, EntityViewDispl
if ($view_mode != 'rss') { if ($view_mode != 'rss') {
// Add content that should NOT be displayed in the RSS feed. // Add content that should NOT be displayed in the RSS feed.
$build['extra_non_feed_content'] = array( $build['extra_non_feed_content'] = array(
'#markup' => '<p>' . t('Extra data that should appear everywhere except the RSS feed for node !nid.', array('!nid' => $node->id())) . '</p>', '#markup' => '<p>' . t('Extra data that should appear everywhere except the RSS feed for node @nid.', array('@nid' => $node->id())) . '</p>',
); );
} }
} }
......
...@@ -326,7 +326,7 @@ function testNodeDisplay() { ...@@ -326,7 +326,7 @@ function testNodeDisplay() {
); );
$this->drupalPostForm($this->adminPath, $edit, t('Save field settings')); $this->drupalPostForm($this->adminPath, $edit, t('Save field settings'));
$this->assertText(format_string('Updated field !field_name field settings.', array('!field_name' => $this->fieldName)), "The 'On' and 'Off' form fields work for boolean fields."); $this->assertText(format_string('Updated field @field_name field settings.', array('@field_name' => $this->fieldName)), "The 'On' and 'Off' form fields work for boolean fields.");
// Select a default value. // Select a default value.
$edit = array( $edit = array(
......
...@@ -269,7 +269,7 @@ function testSelectListSingle() { ...@@ -269,7 +269,7 @@ function testSelectListSingle() {
// Submit form: select invalid 'none' option. // Submit form: select invalid 'none' option.
$edit = array('card_1' => '_none'); $edit = array('card_1' => '_none');
$this->drupalPostForm(NULL, $edit, t('Save')); $this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertRaw(t('!title field is required.', array('!title' => $field->getName())), 'Cannot save a required field when selecting "none" from the select list.'); $this->assertRaw(t('@title field is required.', array('@title' => $field->getName())), 'Cannot save a required field when selecting "none" from the select list.');
// Submit form: select first option. // Submit form: select first option.
$edit = array('card_1' => 0); $edit = array('card_1' => 0);
......
...@@ -184,7 +184,7 @@ public function testPathElement() { ...@@ -184,7 +184,7 @@ public function testPathElement() {
$errors = $form_state->getErrors(); $errors = $form_state->getErrors();
// Should be missing 'required_validate' field. // Should be missing 'required_validate' field.
$this->assertEqual(count($errors), 1); $this->assertEqual(count($errors), 1);
$this->assertEqual($errors, array('required_validate' => t('!name field is required.', array('!name' => 'required_validate')))); $this->assertEqual($errors, array('required_validate' => t('@name field is required.', array('@name' => 'required_validate'))));
// Test invalid parameters. // Test invalid parameters.
$form_state = (new FormState()) $form_state = (new FormState())
......
...@@ -35,7 +35,7 @@ function testFormEmail() { ...@@ -35,7 +35,7 @@ function testFormEmail() {
$edit['email_required'] = ' '; $edit['email_required'] = ' ';
$this->drupalPostForm('form-test/email', $edit, 'Submit'); $this->drupalPostForm('form-test/email', $edit, 'Submit');
$this->assertRaw(t('The email address %mail is not valid.', array('%mail' => 'invalid'))); $this->assertRaw(t('The email address %mail is not valid.', array('%mail' => 'invalid')));
$this->assertRaw(t('!name field is required.', array('!name' => 'Address'))); $this->assertRaw(t('@name field is required.', array('@name' => 'Address')));
$edit = array(); $edit = array();
$edit['email_required'] = ' foo.bar@example.com '; $edit['email_required'] = ' foo.bar@example.com ';
......
...@@ -185,7 +185,7 @@ function testRequiredCheckboxesRadio() { ...@@ -185,7 +185,7 @@ function testRequiredCheckboxesRadio() {
$expected[] = $form[$key]['#form_test_required_error']; $expected[] = $form[$key]['#form_test_required_error'];
} }
else { else {
$expected[] = t('!name field is required.', array('!name' => $form[$key]['#title'])); $expected[] = t('@name field is required.', array('@name' => $form[$key]['#title']));
} }
} }
...@@ -335,7 +335,7 @@ function testCheckboxProcessing() { ...@@ -335,7 +335,7 @@ function testCheckboxProcessing() {
// First, try to submit without the required checkbox. // First, try to submit without the required checkbox.
$edit = array(); $edit = array();
$this->drupalPostForm('form-test/checkbox', $edit, t('Submit')); $this->drupalPostForm('form-test/checkbox', $edit, t('Submit'));
$this->assertRaw(t('!name field is required.', array('!name' => 'required_checkbox')), 'A required checkbox is actually mandatory'); $this->assertRaw(t('@name field is required.', array('@name' => 'required_checkbox')), 'A required checkbox is actually mandatory');
// Now try to submit the form correctly. // Now try to submit the form correctly.
$values = Json::decode($this->drupalPostForm(NULL, array('required_checkbox' => 1), t('Submit'))); $values = Json::decode($this->drupalPostForm(NULL, array('required_checkbox' => 1), t('Submit')));
...@@ -361,7 +361,6 @@ function testCheckboxProcessing() { ...@@ -361,7 +361,6 @@ function testCheckboxProcessing() {
*/ */
function testSelect() { function testSelect() {
$form = \Drupal::formBuilder()->getForm('Drupal\form_test\Form\FormTestSelectForm'); $form = \Drupal::formBuilder()->getForm('Drupal\form_test\Form\FormTestSelectForm');
$error = '!name field is required.';
$this->drupalGet('form-test/select'); $this->drupalGet('form-test/select');