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
98be22d24b
commit
497ebcd2e3
|
@ -40,7 +40,7 @@ class UpdateFeedItemTest extends AggregatorTestBase {
|
|||
$this->assertResponse(200);
|
||||
|
||||
$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();
|
||||
$feed = Feed::load($fid);
|
||||
|
@ -62,7 +62,7 @@ class UpdateFeedItemTest extends AggregatorTestBase {
|
|||
$feed->refreshItems();
|
||||
|
||||
$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
|
||||
// that provides the selected plugins.
|
||||
|
|
|
@ -48,8 +48,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
|
|||
$this->drupalPostForm('block/add/basic', $edit, t('Save'));
|
||||
|
||||
// Check that the Basic block has been created.
|
||||
$this->assertRaw(format_string('!block %name has been created.', array(
|
||||
'!block' => 'basic',
|
||||
$this->assertRaw(format_string('@block %name has been created.', array(
|
||||
'@block' => 'basic',
|
||||
'%name' => $edit['info[0][value]']
|
||||
)), 'Basic block created.');
|
||||
|
||||
|
@ -95,8 +95,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
|
|||
$this->drupalPostForm('block/add/basic', $edit, t('Save'));
|
||||
|
||||
// Check that the Basic block has been created.
|
||||
$this->assertRaw(format_string('!block %name has been created.', array(
|
||||
'!block' => 'basic',
|
||||
$this->assertRaw(format_string('@block %name has been created.', array(
|
||||
'@block' => 'basic',
|
||||
'%name' => $edit['info[0][value]']
|
||||
)), 'Basic block created.');
|
||||
|
||||
|
@ -144,8 +144,8 @@ class BlockContentCreationTest extends BlockContentTestBase {
|
|||
$this->drupalPostForm('block/add', $edit, t('Save'));
|
||||
|
||||
// Check that the block has been created and that it is a basic block.
|
||||
$this->assertRaw(format_string('!block %name has been created.', array(
|
||||
'!block' => 'basic',
|
||||
$this->assertRaw(format_string('@block %name has been created.', array(
|
||||
'@block' => 'basic',
|
||||
'%name' => $edit['info[0][value]'],
|
||||
)), 'Basic block created.');
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ class BlockContentRevisionsTest extends BlockContentTestBase {
|
|||
// Confirm the correct revision text appears.
|
||||
$loaded = entity_revision_load('block_content', $revision_id);
|
||||
// Verify revision log is the same.
|
||||
$this->assertEqual($loaded->getRevisionLog(), $logs[$delta], format_string('Correct log message found for revision !revision', array(
|
||||
'!revision' => $loaded->getRevisionId(),
|
||||
$this->assertEqual($loaded->getRevisionLog(), $logs[$delta], format_string('Correct log message found for revision @revision', array(
|
||||
'@revision' => $loaded->getRevisionId(),
|
||||
)));
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class PageEditTest extends BlockContentTestBase {
|
|||
// Test deleting the block.
|
||||
$this->drupalGet("block/" . $revised_block->id());
|
||||
$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 @@ class ConfigExportImportUITest extends WebTestBase {
|
|||
// Verify that there are configuration differences to import.
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$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.test2')));
|
||||
$this->assertText(t('@collection configuration collection', array('@collection' => 'collection.test1')));
|
||||
$this->assertText(t('@collection configuration collection', array('@collection' => 'collection.test2')));
|
||||
$this->assertText('config_test.create');
|
||||
$this->assertLinkByHref('admin/config/development/configuration/sync/diff_collection/collection.test1/config_test.create');
|
||||
$this->assertText('config_test.update');
|
||||
|
|
|
@ -116,7 +116,7 @@ class ConfigTranslationOverviewTest extends WebTestBase {
|
|||
$entity_type = \Drupal::entityManager()->getDefinition($test_entity->getEntityTypeId());
|
||||
$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));
|
||||
$this->assertRaw($title);
|
||||
$this->assertRaw('<th>' . t('Language') . '</th>');
|
||||
|
|
|
@ -370,7 +370,7 @@ class ConfigTranslationUiTest extends WebTestBase {
|
|||
|
||||
// Test that delete links work and operations perform properly.
|
||||
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->assertRaw(t('Are you sure you want to delete the @language translation of %label?', $replacements));
|
||||
|
|
|
@ -129,7 +129,7 @@ class ContactSitewideTest extends WebTestBase {
|
|||
$max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH;
|
||||
$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->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->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ class FormTest extends FieldTestBase {
|
|||
// Submit with missing required value.
|
||||
$edit = array();
|
||||
$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
|
||||
$value = mt_rand(1, 127);
|
||||
|
@ -228,7 +228,7 @@ class FormTest extends FieldTestBase {
|
|||
"{$field_name}[0][value]" => $value,
|
||||
);
|
||||
$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() {
|
||||
|
|
|
@ -81,7 +81,7 @@ class StringFieldTest extends WebTestBase {
|
|||
$this->drupalGet('entity_test/add');
|
||||
$this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is 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.
|
||||
$value = $this->randomMachineName();
|
||||
|
|
|
@ -220,7 +220,7 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$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->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.');
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
|
@ -254,7 +254,7 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$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('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.');
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
|
@ -272,7 +272,7 @@ class SaveUploadTest extends FileManagedTestBase {
|
|||
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
|
||||
$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->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.');
|
||||
|
||||
// Check that the correct hooks were called.
|
||||
|
|
|
@ -280,7 +280,7 @@ class FilterFormatAccessTest extends WebTestBase {
|
|||
$edit = array();
|
||||
$edit['title[0][value]'] = $new_title;
|
||||
$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->assertText($old_title, 'Old title found.');
|
||||
$this->assertNoText($new_title, 'New title not found.');
|
||||
|
@ -315,7 +315,7 @@ class FilterFormatAccessTest extends WebTestBase {
|
|||
$edit = array();
|
||||
$edit['title[0][value]'] = $new_title;
|
||||
$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->assertText($old_title, 'Old title found.');
|
||||
$this->assertNoText($new_title, 'New title not found.');
|
||||
|
|
|
@ -40,8 +40,8 @@ class LanguageCustomLanguageConfigurationTest extends WebTestBase {
|
|||
);
|
||||
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
|
||||
// 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 name'))));
|
||||
$this->assertText(t('@name field is required.', array('@name' => t('Language code'))));
|
||||
$this->assertText(t('@name field is required.', array('@name' => t('Language name'))));
|
||||
$empty_language = new Language();
|
||||
$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.');
|
||||
|
|
|
@ -277,14 +277,14 @@ class LinkFieldTest extends WebTestBase {
|
|||
"{$field_name}[0][uri]" => 'http://www.example.com',
|
||||
);
|
||||
$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.
|
||||
$edit = array(
|
||||
"{$field_name}[0][uri]" => '',
|
||||
);
|
||||
$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.
|
||||
$this->drupalGet('entity_test/add');
|
||||
|
@ -293,7 +293,7 @@ class LinkFieldTest extends WebTestBase {
|
|||
"{$field_name}[0][title]" => 'Example',
|
||||
);
|
||||
$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 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
|
|||
|
||||
// Check if translations are available for Drupal core.
|
||||
$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');
|
||||
$update_button = $this->xpath('//input[@type="submit"][@value="' . t('Update translations') . '"]');
|
||||
$this->assertTrue($update_button, 'Update translations button');
|
||||
|
|
|
@ -195,8 +195,8 @@ class MenuTest extends MenuWebTestBase {
|
|||
|
||||
// Verify that using a menu_name that is too long results in a validation
|
||||
// message.
|
||||
$this->assertRaw(t('!name cannot be longer than %max characters but is currently %length characters long.', array(
|
||||
'!name' => t('Menu name'),
|
||||
$this->assertRaw(t('@name cannot be longer than %max characters but is currently %length characters long.', array(
|
||||
'@name' => t('Menu name'),
|
||||
'%max' => MENU_MAX_MENU_NAME_LENGTH_UI,
|
||||
'%length' => Unicode::strlen($menu_name),
|
||||
)));
|
||||
|
@ -207,8 +207,8 @@ class MenuTest extends MenuWebTestBase {
|
|||
$this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
|
||||
|
||||
// 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(
|
||||
'!name' => t('Menu name'),
|
||||
$this->assertNoRaw(t('@name cannot be longer than %max characters but is currently %length characters long.', array(
|
||||
'@name' => t('Menu name'),
|
||||
'%max' => MENU_MAX_MENU_NAME_LENGTH_UI,
|
||||
'%length' => Unicode::strlen($menu_name),
|
||||
)));
|
||||
|
|
|
@ -52,7 +52,7 @@ class NodeCreationTest extends NodeTestBase {
|
|||
$this->drupalPostForm('node/add/page', $edit, t('Save'));
|
||||
|
||||
// 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.
|
||||
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
|
||||
|
@ -141,7 +141,7 @@ class NodeCreationTest extends NodeTestBase {
|
|||
$this->assertText(t('Test page text'));
|
||||
|
||||
// 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 @@ class NodeRSSContentTest extends NodeTestBase {
|
|||
$this->drupalGet('rss.xml');
|
||||
|
||||
// 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.');
|
||||
|
||||
// Check that content added in view modes other than 'rss' doesn't
|
||||
// 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.');
|
||||
|
||||
// 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"';
|
||||
$this->assertRaw($test_element, 'Extra RSS elements 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
|
|||
// Add RSS elements and namespaces when building the RSS feed.
|
||||
$node->rss_elements[] = array(
|
||||
'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.
|
||||
$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,
|
||||
);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ function node_test_node_view(array &$build, NodeInterface $node, EntityViewDispl
|
|||
if ($view_mode != 'rss') {
|
||||
// Add content that should NOT be displayed in the RSS feed.
|
||||
$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 @@ class OptionsFieldUITest extends FieldTestBase {
|
|||
);
|
||||
|
||||
$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.
|
||||
$edit = array(
|
||||
|
|
|
@ -269,7 +269,7 @@ class OptionsWidgetsTest extends FieldTestBase {
|
|||
// Submit form: select invalid 'none' option.
|
||||
$edit = array('card_1' => '_none');
|
||||
$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.
|
||||
$edit = array('card_1' => 0);
|
||||
|
|
|
@ -184,7 +184,7 @@ class PathElementFormTest extends KernelTestBase implements FormInterface {
|
|||
$errors = $form_state->getErrors();
|
||||
// Should be missing 'required_validate' field.
|
||||
$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.
|
||||
$form_state = (new FormState())
|
||||
|
|
|
@ -35,7 +35,7 @@ class EmailTest extends WebTestBase {
|
|||
$edit['email_required'] = ' ';
|
||||
$this->drupalPostForm('form-test/email', $edit, 'Submit');
|
||||
$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['email_required'] = ' foo.bar@example.com ';
|
||||
|
|
|
@ -185,7 +185,7 @@ class FormTest extends WebTestBase {
|
|||
$expected[] = $form[$key]['#form_test_required_error'];
|
||||
}
|
||||
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 @@ class FormTest extends WebTestBase {
|
|||
// First, try to submit without the required checkbox.
|
||||
$edit = array();
|
||||
$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.
|
||||
$values = Json::decode($this->drupalPostForm(NULL, array('required_checkbox' => 1), t('Submit')));
|
||||
|
@ -361,7 +361,6 @@ class FormTest extends WebTestBase {
|
|||
*/
|
||||
function testSelect() {
|
||||
$form = \Drupal::formBuilder()->getForm('Drupal\form_test\Form\FormTestSelectForm');
|
||||
$error = '!name field is required.';
|
||||
$this->drupalGet('form-test/select');
|
||||
|
||||
// Posting without any values should throw validation errors.
|
||||
|
@ -379,7 +378,7 @@ class FormTest extends WebTestBase {
|
|||
'multiple_no_default',
|
||||
);
|
||||
foreach ($no_errors as $key) {
|
||||
$this->assertNoText(t('!name field is required.', array('!name' => $form[$key]['#title'])));
|
||||
$this->assertNoText(t('@name field is required.', array('@name' => $form[$key]['#title'])));
|
||||
}
|
||||
|
||||
$expected_errors = array(
|
||||
|
@ -390,7 +389,7 @@ class FormTest extends WebTestBase {
|
|||
'multiple_no_default_required',
|
||||
);
|
||||
foreach ($expected_errors as $key) {
|
||||
$this->assertText(t('!name field is required.', array('!name' => $form[$key]['#title'])));
|
||||
$this->assertText(t('@name field is required.', array('@name' => $form[$key]['#title'])));
|
||||
}
|
||||
|
||||
// Post values for required fields.
|
||||
|
|
|
@ -35,7 +35,7 @@ class UrlTest extends WebTestBase {
|
|||
$edit['url_required'] = ' ';
|
||||
$this->drupalPostForm('form-test/url', $edit, 'Submit');
|
||||
$this->assertRaw(t('The URL %url is not valid.', array('%url' => 'http://')));
|
||||
$this->assertRaw(t('!name field is required.', array('!name' => 'Required URL')));
|
||||
$this->assertRaw(t('@name field is required.', array('@name' => 'Required URL')));
|
||||
|
||||
$edit = array();
|
||||
$edit['url'] = "\n";
|
||||
|
|
|
@ -118,19 +118,19 @@ class ValidationTest extends WebTestBase {
|
|||
// validated, but the #element_validate handler for the 'test' field
|
||||
// is triggered.
|
||||
$this->drupalPostForm($path, $edit, t('Partial validate'));
|
||||
$this->assertNoText(t('!name field is required.', array('!name' => 'Title')));
|
||||
$this->assertNoText(t('@name field is required.', array('@name' => 'Title')));
|
||||
$this->assertText('Test element is invalid');
|
||||
|
||||
// Edge case of #limit_validation_errors containing numeric indexes: same
|
||||
// thing with the 'Partial validate (numeric index)' button and the
|
||||
// 'test_numeric_index' field.
|
||||
$this->drupalPostForm($path, $edit, t('Partial validate (numeric index)'));
|
||||
$this->assertNoText(t('!name field is required.', array('!name' => 'Title')));
|
||||
$this->assertNoText(t('@name field is required.', array('@name' => 'Title')));
|
||||
$this->assertText('Test (numeric index) element is invalid');
|
||||
|
||||
// Ensure something like 'foobar' isn't considered "inside" 'foo'.
|
||||
$this->drupalPostForm($path, $edit, t('Partial validate (substring)'));
|
||||
$this->assertNoText(t('!name field is required.', array('!name' => 'Title')));
|
||||
$this->assertNoText(t('@name field is required.', array('@name' => 'Title')));
|
||||
$this->assertText('Test (substring) foo element is invalid');
|
||||
|
||||
// Ensure not validated values are not available to submit handlers.
|
||||
|
@ -140,7 +140,7 @@ class ValidationTest extends WebTestBase {
|
|||
// Now test full form validation and ensure that the #element_validate
|
||||
// handler is still triggered.
|
||||
$this->drupalPostForm($path, $edit, t('Full validate'));
|
||||
$this->assertText(t('!name field is required.', array('!name' => 'Title')));
|
||||
$this->assertText(t('@name field is required.', array('@name' => 'Title')));
|
||||
$this->assertText('Test element is invalid');
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ class ValidationTest extends WebTestBase {
|
|||
$messages = [];
|
||||
foreach (Element::children($form) as $key) {
|
||||
if (isset($form[$key]['#required_error'])) {
|
||||
$this->assertNoText(t('!name field is required.', array('!name' => $form[$key]['#title'])));
|
||||
$this->assertNoText(t('@name field is required.', array('@name' => $form[$key]['#title'])));
|
||||
$messages[] = [
|
||||
'title' => $form[$key]['#title'],
|
||||
'message' => $form[$key]['#required_error'],
|
||||
|
@ -226,7 +226,7 @@ class ValidationTest extends WebTestBase {
|
|||
];
|
||||
}
|
||||
elseif (isset($form[$key]['#form_test_required_error'])) {
|
||||
$this->assertNoText(t('!name field is required.', array('!name' => $form[$key]['#title'])));
|
||||
$this->assertNoText(t('@name field is required.', array('@name' => $form[$key]['#title'])));
|
||||
$messages[] = [
|
||||
'title' => $form[$key]['#title'],
|
||||
'message' => $form[$key]['#form_test_required_error'],
|
||||
|
@ -236,7 +236,7 @@ class ValidationTest extends WebTestBase {
|
|||
elseif (!empty($form[$key]['#required'])) {
|
||||
$messages[] = [
|
||||
'title' => $form[$key]['#title'],
|
||||
'message' => t('!name field is required.', ['!name' => $form[$key]['#title']]),
|
||||
'message' => t('@name field is required.', ['@name' => $form[$key]['#title']]),
|
||||
'key' => $key,
|
||||
];
|
||||
}
|
||||
|
@ -254,17 +254,17 @@ class ValidationTest extends WebTestBase {
|
|||
$messages = [];
|
||||
foreach (Element::children($form) as $key) {
|
||||
if (isset($form[$key]['#required_error'])) {
|
||||
$this->assertNoText(t('!name field is required.', array('!name' => $form[$key]['#title'])));
|
||||
$this->assertNoText(t('@name field is required.', array('@name' => $form[$key]['#title'])));
|
||||
$this->assertNoText($form[$key]['#required_error']);
|
||||
}
|
||||
elseif (isset($form[$key]['#form_test_required_error'])) {
|
||||
$this->assertNoText(t('!name field is required.', array('!name' => $form[$key]['#title'])));
|
||||
$this->assertNoText(t('@name field is required.', array('@name' => $form[$key]['#title'])));
|
||||
$this->assertNoText($form[$key]['#form_test_required_error']);
|
||||
}
|
||||
elseif (!empty($form[$key]['#required'])) {
|
||||
$messages[] = [
|
||||
'title' => $form[$key]['#title'],
|
||||
'message' => t('!name field is required.', ['!name' => $form[$key]['#title']]),
|
||||
'message' => t('@name field is required.', ['@name' => $form[$key]['#title']]),
|
||||
'key' => $key,
|
||||
];
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class ThemeTest extends WebTestBase {
|
|||
$foos = array('null' => NULL, 'false' => FALSE, 'integer' => 1, 'string' => 'foo', 'empty_string' => '');
|
||||
foreach ($foos as $type => $example) {
|
||||
$output = \Drupal::theme()->render('theme_test_foo', array('foo' => $example));
|
||||
$this->assertTrue($output instanceof SafeStringInterface || is_string($output), format_string('\Drupal::theme() returns an object that implements SafeStringInterface or a string for data type !type.', array('!type' => $type)));
|
||||
$this->assertTrue($output instanceof SafeStringInterface || is_string($output), format_string('\Drupal::theme() returns an object that implements SafeStringInterface or a string for data type @type.', array('@type' => $type)));
|
||||
if ($output instanceof SafeStringInterface) {
|
||||
$this->assertIdentical((string) $example, $output->__toString());
|
||||
}
|
||||
|
|
|
@ -33,12 +33,12 @@ class FormTestVerticalTabsForm extends FormBase {
|
|||
for ($i = 1; $i <= $tab_count; $i++) {
|
||||
$form['tab' . $i] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Tab !num', array('!num' => $i)),
|
||||
'#title' => t('Tab @num', array('@num' => $i)),
|
||||
'#group' => 'vertical_tabs',
|
||||
'#access' => \Drupal::currentUser()->hasPermission('access vertical_tab_test tabs'),
|
||||
);
|
||||
$form['tab' . $i]['field' . $i] = array(
|
||||
'#title' => t('Field !num', array('!num' => $i)),
|
||||
'#title' => t('Field @num', array('@num' => $i)),
|
||||
'#type' => 'textfield',
|
||||
|
||||
);
|
||||
|
|
|
@ -38,7 +38,7 @@ class LoadMultipleTest extends TaxonomyTestBase {
|
|||
// Load the terms from the vocabulary.
|
||||
$terms = entity_load_multiple_by_properties('taxonomy_term', array('vid' => $vocabulary->id()));
|
||||
$count = count($terms);
|
||||
$this->assertEqual($count, 5, format_string('Correct number of terms were loaded. !count terms.', array('!count' => $count)));
|
||||
$this->assertEqual($count, 5, format_string('Correct number of terms were loaded. @count terms.', array('@count' => $count)));
|
||||
|
||||
// Load the same terms again by tid.
|
||||
$terms2 = Term::loadMultiple(array_keys($terms));
|
||||
|
|
|
@ -58,7 +58,7 @@ class UserRolesAssignmentTest extends WebTestBase {
|
|||
"roles[$rid]" => $rid,
|
||||
);
|
||||
$this->drupalPostForm('admin/people/create', $edit, t('Create new account'));
|
||||
$this->assertText(t('Created a new user account for !name.', array('!name' => $edit['name'])));
|
||||
$this->assertText(t('Created a new user account for @name.', array('@name' => $edit['name'])));
|
||||
// Get the newly added user.
|
||||
$account = user_load_by_name($edit['name']);
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ class UserValidationTest extends KernelTestBase {
|
|||
$violations = $user->validate();
|
||||
$this->assertEqual(count($violations), 1, 'E-mail addresses may not be removed');
|
||||
$this->assertEqual($violations[0]->getPropertyPath(), 'mail');
|
||||
$this->assertEqual($violations[0]->getMessage(), t('!name field is required.', array('!name' => $user->getFieldDefinition('mail')->getLabel())));
|
||||
$this->assertEqual($violations[0]->getMessage(), t('@name field is required.', array('@name' => $user->getFieldDefinition('mail')->getLabel())));
|
||||
$user->set('mail', 'someone@example.com');
|
||||
|
||||
$user->set('timezone', $this->randomString(33));
|
||||
|
|
|
@ -242,25 +242,25 @@ class FieldKernelTest extends ViewKernelTestBase {
|
|||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($name_field_0, $row) {
|
||||
return $name_field_0->advancedRender($row);
|
||||
});
|
||||
$this->assertEqual($output, $expected_output_0, format_string('Test token replacement: "!token" gave "!output"', [
|
||||
'!token' => $name_field_0->options['alter']['text'],
|
||||
'!output' => $output,
|
||||
$this->assertEqual($output, $expected_output_0, format_string('Test token replacement: "@token" gave "@output"', [
|
||||
'@token' => $name_field_0->options['alter']['text'],
|
||||
'@output' => $output,
|
||||
]));
|
||||
|
||||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($name_field_1, $row) {
|
||||
return $name_field_1->advancedRender($row);
|
||||
});
|
||||
$this->assertEqual($output, $expected_output_1, format_string('Test token replacement: "!token" gave "!output"', [
|
||||
'!token' => $name_field_1->options['alter']['text'],
|
||||
'!output' => $output,
|
||||
$this->assertEqual($output, $expected_output_1, format_string('Test token replacement: "@token" gave "@output"', [
|
||||
'@token' => $name_field_1->options['alter']['text'],
|
||||
'@output' => $output,
|
||||
]));
|
||||
|
||||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($name_field_2, $row) {
|
||||
return $name_field_2->advancedRender($row);
|
||||
});
|
||||
$this->assertEqual($output, $expected_output_2, format_string('Test token replacement: "!token" gave "!output"', [
|
||||
'!token' => $name_field_2->options['alter']['text'],
|
||||
'!output' => $output,
|
||||
$this->assertEqual($output, $expected_output_2, format_string('Test token replacement: "@token" gave "@output"', [
|
||||
'@token' => $name_field_2->options['alter']['text'],
|
||||
'@output' => $output,
|
||||
]));
|
||||
}
|
||||
|
||||
|
@ -273,10 +273,10 @@ class FieldKernelTest extends ViewKernelTestBase {
|
|||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($job_field, $row) {
|
||||
return $job_field->advancedRender($row);
|
||||
});
|
||||
$this->assertSubString($output, $random_text, format_string('Make sure the self token (!token => !value) appears in the output (!output)', [
|
||||
'!value' => $random_text,
|
||||
'!output' => $output,
|
||||
'!token' => $job_field->options['alter']['text'],
|
||||
$this->assertSubString($output, $random_text, format_string('Make sure the self token (@token => @value) appears in the output (@output)', [
|
||||
'@value' => $random_text,
|
||||
'@output' => $output,
|
||||
'@token' => $job_field->options['alter']['text'],
|
||||
]));
|
||||
|
||||
// Verify the token format used in D7 and earlier does not get substituted.
|
||||
|
@ -287,10 +287,10 @@ class FieldKernelTest extends ViewKernelTestBase {
|
|||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($job_field, $row) {
|
||||
return $job_field->advancedRender($row);
|
||||
});
|
||||
$this->assertEqual($output, $old_token, format_string('Make sure the old token style (!token => !value) is not changed in the output (!output)', [
|
||||
'!value' => $random_text,
|
||||
'!output' => $output,
|
||||
'!token' => $job_field->options['alter']['text'],
|
||||
$this->assertEqual($output, $old_token, format_string('Make sure the old token style (@token => @value) is not changed in the output (@output)', [
|
||||
'@value' => $random_text,
|
||||
'@output' => $output,
|
||||
'@token' => $job_field->options['alter']['text'],
|
||||
]));
|
||||
|
||||
// Verify HTML tags are allowed in rewrite templates while token
|
||||
|
@ -320,9 +320,9 @@ class FieldKernelTest extends ViewKernelTestBase {
|
|||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($job_field, $row) {
|
||||
return $job_field->advancedRender($row);
|
||||
});
|
||||
$this->assertEqual($output, $random_text, format_string('Make sure a script tag in the template (!template) is removed, leaving only the replaced token in the output (!output)', [
|
||||
'!output' => $output,
|
||||
'!template' => $rewrite_template,
|
||||
$this->assertEqual($output, $random_text, format_string('Make sure a script tag in the template (@template) is removed, leaving only the replaced token in the output (@output)', [
|
||||
'@output' => $output,
|
||||
'@template' => $rewrite_template,
|
||||
]));
|
||||
}
|
||||
|
||||
|
|
|
@ -564,14 +564,14 @@ class FieldWebTest extends HandlerTestBase {
|
|||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($name_field, $row) {
|
||||
return $name_field->advancedRender($row);
|
||||
});
|
||||
$this->assertSubString($output, $trimmed_name, format_string('Make sure the trimmed output (!trimmed) appears in the rendered output (!output).', array('!trimmed' => $trimmed_name, '!output' => $output)));
|
||||
$this->assertNotSubString($output, $row->views_test_data_name, format_string("Make sure the untrimmed value (!untrimmed) shouldn't appear in the rendered output (!output).", array('!untrimmed' => $row->views_test_data_name, '!output' => $output)));
|
||||
$this->assertSubString($output, $trimmed_name, format_string('Make sure the trimmed output (@trimmed) appears in the rendered output (@output).', array('@trimmed' => $trimmed_name, '@output' => $output)));
|
||||
$this->assertNotSubString($output, $row->views_test_data_name, format_string("Make sure the untrimmed value (@untrimmed) shouldn't appear in the rendered output (@output).", array('@untrimmed' => $row->views_test_data_name, '@output' => $output)));
|
||||
|
||||
$name_field->options['alter']['max_length'] = 9;
|
||||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($name_field, $row) {
|
||||
return $name_field->advancedRender($row);
|
||||
});
|
||||
$this->assertSubString($output, $trimmed_name, format_string('Make sure the untrimmed (!untrimmed) output appears in the rendered output (!output).', array('!trimmed' => $trimmed_name, '!output' => $output)));
|
||||
$this->assertSubString($output, $trimmed_name, format_string('Make sure the untrimmed (@untrimmed) output appears in the rendered output (@output).', array('@trimmed' => $trimmed_name, '@output' => $output)));
|
||||
|
||||
// Take word_boundary into account for the tests.
|
||||
$name_field->options['alter']['max_length'] = 5;
|
||||
|
@ -615,10 +615,10 @@ class FieldWebTest extends HandlerTestBase {
|
|||
});
|
||||
|
||||
if ($tuple['trimmed']) {
|
||||
$this->assertNotSubString($output, $tuple['value'], format_string('The untrimmed value (!untrimmed) should not appear in the trimmed output (!output).', array('!untrimmed' => $tuple['value'], '!output' => $output)));
|
||||
$this->assertNotSubString($output, $tuple['value'], format_string('The untrimmed value (@untrimmed) should not appear in the trimmed output (@output).', array('@untrimmed' => $tuple['value'], '@output' => $output)));
|
||||
}
|
||||
if (!empty($tuple['trimmed_value'])) {
|
||||
$this->assertSubString($output, $tuple['trimmed_value'], format_string('The trimmed value (!trimmed) should appear in the trimmed output (!output).', array('!trimmed' => $tuple['trimmed_value'], '!output' => $output)));
|
||||
$this->assertSubString($output, $tuple['trimmed_value'], format_string('The trimmed value (@trimmed) should appear in the trimmed output (@output).', array('@trimmed' => $tuple['trimmed_value'], '@output' => $output)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ class ViewEditTest extends UITestBase {
|
|||
$this->assertResponse(200);
|
||||
$langcode_url = 'admin/structure/views/nojs/display/' . $view_name . '/' . $display . '/rendering_language';
|
||||
$this->assertNoLinkByHref($langcode_url);
|
||||
$this->assertNoLink(t('!type language selected for page', array('!type' => t('Content'))));
|
||||
$this->assertNoLink(t('@type language selected for page', array('@type' => t('Content'))));
|
||||
$this->assertNoLink(t('Content language of view row'));
|
||||
}
|
||||
|
||||
|
@ -127,12 +127,12 @@ class ViewEditTest extends UITestBase {
|
|||
$langcode_url = 'admin/structure/views/nojs/display/' . $view_name . '/' . $display . '/rendering_language';
|
||||
if ($view_name == 'test_view') {
|
||||
$this->assertNoLinkByHref($langcode_url);
|
||||
$this->assertNoLink(t('!type language selected for page', array('!type' => t('Content'))));
|
||||
$this->assertNoLink(t('@type language selected for page', array('@type' => t('Content'))));
|
||||
$this->assertNoLink(t('Content language of view row'));
|
||||
}
|
||||
else {
|
||||
$this->assertLinkByHref($langcode_url);
|
||||
$this->assertNoLink(t('!type language selected for page', array('!type' => t('Content'))));
|
||||
$this->assertNoLink(t('@type language selected for page', array('@type' => t('Content'))));
|
||||
$this->assertLink(t('Content language of view row'));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue