Issue #3231781 by longwave, mondrake, Feuerwagen, larowlan, TR, nlisgo, xxAlHixx, DuaelFr, GoZ, benjy, no_angel, Mac_Weber: [D9.3 beta - w/c Nov 8, 2021] Remove remaining uses of t() in tests
(cherry picked from commit a83a7a7836
)
merge-requests/1416/head
parent
e125ce28f5
commit
6af996bb19
|
@ -56,7 +56,7 @@ class ItemCacheTagsTest extends EntityCacheTagsTestBase {
|
|||
// Create a "Llama" aggregator feed item.
|
||||
$item = Item::create([
|
||||
'fid' => $feed->id(),
|
||||
'title' => t('Llama'),
|
||||
'title' => 'Llama',
|
||||
'path' => 'https://www.drupal.org/',
|
||||
]);
|
||||
$item->save();
|
||||
|
@ -77,7 +77,7 @@ class ItemCacheTagsTest extends EntityCacheTagsTestBase {
|
|||
// Now create a feed item in that feed.
|
||||
Item::create([
|
||||
'fid' => $this->entity->getFeedId(),
|
||||
'title' => t('Llama 2'),
|
||||
'title' => 'Llama 2',
|
||||
'path' => 'https://groups.drupal.org/',
|
||||
])->save();
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class ItemWithoutFeedTest extends KernelTestBase {
|
|||
*/
|
||||
public function testEntityCreation() {
|
||||
$entity = Item::create([
|
||||
'title' => t('Llama 2'),
|
||||
'title' => 'Llama 2',
|
||||
'path' => 'https://groups.drupal.org/',
|
||||
]);
|
||||
$violations = $entity->validate();
|
||||
|
|
|
@ -59,7 +59,7 @@ class BlockInterfaceTest extends KernelTestBase {
|
|||
],
|
||||
'admin_label' => [
|
||||
'#type' => 'item',
|
||||
'#title' => t('Block description'),
|
||||
'#title' => 'Block description',
|
||||
'#plain_text' => $definition['admin_label'],
|
||||
],
|
||||
'label' => [
|
||||
|
@ -78,7 +78,7 @@ class BlockInterfaceTest extends KernelTestBase {
|
|||
'context_mapping' => [],
|
||||
'display_message' => [
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Display message'),
|
||||
'#title' => 'Display message',
|
||||
'#default_value' => 'My custom display message.',
|
||||
],
|
||||
];
|
||||
|
|
|
@ -370,11 +370,8 @@ class CommentPagerTest extends CommentTestBase {
|
|||
// Set comments to one per page so that we are able to test paging without
|
||||
// needing to insert large numbers of comments.
|
||||
$this->setCommentsPerPage(1, $field_name);
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
$comment = t('Comment @count on field @field', [
|
||||
'@count' => $i + 1,
|
||||
'@field' => $field_name,
|
||||
]);
|
||||
for ($i = 1; $i <= 4; $i++) {
|
||||
$comment = "Comment $i on field $field_name";
|
||||
$comments[] = $this->postComment($node, $comment, $comment, TRUE, $field_name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class CommentStatusFieldAccessTest extends BrowserTestBase {
|
|||
parent::setUp();
|
||||
$node_type = NodeType::create([
|
||||
'type' => 'article',
|
||||
'name' => t('Article'),
|
||||
'name' => 'Article',
|
||||
]);
|
||||
$node_type->save();
|
||||
$this->nodeAuthor = $this->drupalCreateUser([
|
||||
|
|
|
@ -51,7 +51,7 @@ class NodeCommentsTest extends CommentTestBase {
|
|||
$this->assertCount(1, $comment_count_without_comment);
|
||||
|
||||
// Create a content type with no comment field, and add a node.
|
||||
$this->drupalCreateContentType(['type' => 'no_comment', 'name' => t('No comment page')]);
|
||||
$this->drupalCreateContentType(['type' => 'no_comment', 'name' => 'No comment page']);
|
||||
$this->nodeUserPosted = $this->drupalCreateNode(['type' => 'no_comment']);
|
||||
$this->drupalGet('test-comment-count');
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class WizardTest extends WizardTestBase {
|
|||
*/
|
||||
protected function setUp($import_test_views = TRUE): void {
|
||||
parent::setUp($import_test_views);
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => t('Basic page')]);
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
// Add comment field to page node type.
|
||||
$this->addDefaultCommentField('node', 'page');
|
||||
}
|
||||
|
|
|
@ -59,17 +59,17 @@ class ConfigEntityListTest extends BrowserTestBase {
|
|||
// Test getOperations() method.
|
||||
$expected_operations = [
|
||||
'edit' => [
|
||||
'title' => t('Edit'),
|
||||
'title' => 'Edit',
|
||||
'weight' => 10,
|
||||
'url' => $entity->toUrl()->setOption('query', $this->getRedirectDestination()->getAsArray()),
|
||||
],
|
||||
'disable' => [
|
||||
'title' => t('Disable'),
|
||||
'title' => 'Disable',
|
||||
'weight' => 40,
|
||||
'url' => $entity->toUrl('disable')->setOption('query', $this->getRedirectDestination()->getAsArray()),
|
||||
],
|
||||
'delete' => [
|
||||
'title' => t('Delete'),
|
||||
'title' => 'Delete',
|
||||
'weight' => 100,
|
||||
'url' => $entity->toUrl('delete-form')->setOption('query', $this->getRedirectDestination()->getAsArray()),
|
||||
],
|
||||
|
@ -134,12 +134,12 @@ class ConfigEntityListTest extends BrowserTestBase {
|
|||
// Test getOperations() method.
|
||||
$expected_operations = [
|
||||
'edit' => [
|
||||
'title' => t('Edit'),
|
||||
'title' => 'Edit',
|
||||
'weight' => 10,
|
||||
'url' => $entity->toUrl()->setOption('query', $this->getRedirectDestination()->getAsArray()),
|
||||
],
|
||||
'delete' => [
|
||||
'title' => t('Delete'),
|
||||
'title' => 'Delete',
|
||||
'weight' => 100,
|
||||
'url' => $entity->toUrl('delete-form')->setOption('query', $this->getRedirectDestination()->getAsArray()),
|
||||
],
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace Drupal\Tests\contact\Functional;
|
||||
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Component\Render\PlainTextOutput;
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Test\AssertMailTrait;
|
||||
|
@ -93,14 +92,9 @@ class ContactPersonalTest extends BrowserTestBase {
|
|||
$this->assertEquals($this->config('system.site')->get('mail'), $mail['from']);
|
||||
$this->assertEquals($this->webUser->getEmail(), $mail['reply-to']);
|
||||
$this->assertEquals('user_mail', $mail['key']);
|
||||
$variables = [
|
||||
'@site-name' => $this->config('system.site')->get('name'),
|
||||
'@subject' => $message['subject[0][value]'],
|
||||
'@recipient-name' => $this->contactUser->getDisplayName(),
|
||||
];
|
||||
$subject = PlainTextOutput::renderFromHtml(t('[@site-name] @subject', $variables));
|
||||
$subject = '[' . $this->config('system.site')->get('name') . '] ' . $message['subject[0][value]'];
|
||||
$this->assertEquals($subject, $mail['subject'], 'Subject is in sent message.');
|
||||
$this->assertStringContainsString('Hello ' . $variables['@recipient-name'], $mail['body'], 'Recipient name is in sent message.');
|
||||
$this->assertStringContainsString('Hello ' . $this->contactUser->getDisplayName(), $mail['body'], 'Recipient name is in sent message.');
|
||||
$this->assertStringContainsString($this->webUser->getDisplayName(), $mail['body'], 'Sender name is in sent message.');
|
||||
$this->assertStringContainsString($message['message[0][value]'], $mail['body'], 'Message body is in sent message.');
|
||||
|
||||
|
@ -128,7 +122,7 @@ class ContactPersonalTest extends BrowserTestBase {
|
|||
$message = $this->submitPersonalContact($this->contactUser, $message);
|
||||
|
||||
// Assert mail content.
|
||||
$this->assertMailString('body', 'Hello ' . $variables['@recipient-name'], 1);
|
||||
$this->assertMailString('body', 'Hello ' . $this->contactUser->getDisplayName(), 1);
|
||||
$this->assertMailString('body', $this->webUser->getDisplayName(), 1);
|
||||
$this->assertMailString('body', Html::Escape($message['message[0][value]']), 1);
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
|
|||
$this->doTestWorkflows($this->administrator, $expected_status);
|
||||
|
||||
// Check that translation permissions allow the associated operations.
|
||||
$ops = ['create' => t('Add'), 'update' => t('Edit'), 'delete' => t('Delete')];
|
||||
$ops = ['create' => 'Add', 'update' => 'Edit', 'delete' => 'Delete'];
|
||||
$translations_url = $this->entity->toUrl('drupal:content-translation-overview');
|
||||
foreach ($ops as $current_op => $item) {
|
||||
$user = $this->drupalCreateUser([
|
||||
|
|
|
@ -377,8 +377,8 @@ class DbLogTest extends BrowserTestBase {
|
|||
private function verifyEvents() {
|
||||
// Invoke events.
|
||||
$this->doUser();
|
||||
$this->drupalCreateContentType(['type' => 'article', 'name' => t('Article')]);
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => t('Basic page')]);
|
||||
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
$this->doNode('article');
|
||||
$this->doNode('page');
|
||||
$this->doNode('forum');
|
||||
|
|
|
@ -204,7 +204,7 @@ class NestedFormTest extends FieldTestBase {
|
|||
// Submit the form and check that the entities are updated accordingly.
|
||||
$assert_session->hiddenFieldExists('entity_2[changed]')
|
||||
->setValue(REQUEST_TIME - 86400);
|
||||
$page->pressButton(t('Save'));
|
||||
$page->pressButton('Save');
|
||||
|
||||
$elements = $this->cssSelect('.entity-2.error');
|
||||
$this->assertCount(1, $elements, 'The whole nested entity form has been correctly flagged with an error class.');
|
||||
|
|
|
@ -166,12 +166,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
$type = empty($type) ? $this->contentType : $type;
|
||||
$this->drupalGet('admin/structure/types/manage/' . $type . '/fields');
|
||||
// Check all table columns.
|
||||
$table_headers = [
|
||||
t('Label'),
|
||||
t('Machine name'),
|
||||
t('Field type'),
|
||||
t('Operations'),
|
||||
];
|
||||
$table_headers = ['Label', 'Machine name', 'Field type', 'Operations'];
|
||||
foreach ($table_headers as $table_header) {
|
||||
// We check that the label appear in the table headings.
|
||||
$this->assertSession()->responseContains($table_header . '</th>');
|
||||
|
@ -688,7 +683,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
'field_name' => $field_name,
|
||||
'bundle' => $this->contentType,
|
||||
'entity_type' => 'node',
|
||||
'label' => t('Hidden field'),
|
||||
'label' => 'Hidden field',
|
||||
];
|
||||
FieldConfig::create($field)->save();
|
||||
\Drupal::service('entity_display.repository')
|
||||
|
|
|
@ -454,7 +454,7 @@ class ManageDisplayTest extends WebDriverTestBase {
|
|||
$field_field_name->setValue($field_name);
|
||||
$assert_session->assertWaitOnAjaxRequest();
|
||||
|
||||
$page->findButton(t('Save and continue'))->click();
|
||||
$page->findButton('Save and continue')->click();
|
||||
|
||||
$assert_session->pageTextContains("These settings apply to the $label field everywhere it is used.");
|
||||
$breadcrumb_link = $page->findLink($label);
|
||||
|
|
|
@ -629,7 +629,7 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
$this->assertNull($form_display->getComponent($field_name));
|
||||
$this->assertTrue($form_display->get('hidden')[$field_name]);
|
||||
// The correct warning message has been logged.
|
||||
$arguments = ['@display' => (string) t('Entity form display'), '@id' => $form_display->id(), '@name' => $field_name];
|
||||
$arguments = ['@display' => 'Entity form display', '@id' => $form_display->id(), '@name' => $field_name];
|
||||
$variables = Database::getConnection()->select('watchdog', 'w')
|
||||
->fields('w', ['variables'])
|
||||
->condition('type', 'system')
|
||||
|
|
|
@ -90,7 +90,7 @@ class FilePrivateTest extends FileFieldTestBase {
|
|||
// Can't use submitForm() to set hidden fields.
|
||||
$this->drupalGet('node/' . $new_node->id() . '/edit');
|
||||
$this->getSession()->getPage()->find('css', 'input[name="' . $field_name . '[0][fids]"]')->setValue($node_file->id());
|
||||
$this->getSession()->getPage()->pressButton(t('Save'));
|
||||
$this->getSession()->getPage()->pressButton('Save');
|
||||
$this->assertSession()->addressEquals('node/' . $new_node->id());
|
||||
// Make sure the submitted hidden file field is empty.
|
||||
$new_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($new_node->id());
|
||||
|
@ -103,7 +103,7 @@ class FilePrivateTest extends FileFieldTestBase {
|
|||
$this->drupalGet('node/add/' . $type_name);
|
||||
$this->getSession()->getPage()->find('css', 'input[name="title[0][value]"]')->setValue($edit['title[0][value]']);
|
||||
$this->getSession()->getPage()->find('css', 'input[name="' . $field_name . '[0][fids]"]')->setValue($node_file->id());
|
||||
$this->getSession()->getPage()->pressButton(t('Save'));
|
||||
$this->getSession()->getPage()->pressButton('Save');
|
||||
$new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
|
||||
$this->assertSession()->addressEquals('node/' . $new_node->id());
|
||||
// Make sure the submitted hidden file field is empty.
|
||||
|
|
|
@ -76,7 +76,7 @@ class FileManagedFileElementTest extends WebDriverTestBase {
|
|||
$this->submitForm([], 'Save');
|
||||
|
||||
// Remove, then Submit.
|
||||
$remove_button_title = $multiple ? t('Remove selected') : t('Remove');
|
||||
$remove_button_title = $multiple ? 'Remove selected' : 'Remove';
|
||||
$this->drupalGet($path . '/' . $last_fid);
|
||||
if ($multiple) {
|
||||
$selected_checkbox = ($tree ? 'nested[file]' : 'file') . '[file_' . $last_fid . '][selected]';
|
||||
|
|
|
@ -94,8 +94,6 @@ class FilterHtmlImageSecureTest extends BrowserTestBase {
|
|||
|
||||
$druplicon = 'core/misc/druplicon.png';
|
||||
$red_x_image = base_path() . 'core/misc/icons/e32700/error.svg';
|
||||
$alt_text = t('Image removed.');
|
||||
$title_text = t('This image has been removed. For security reasons, only images from the local domain are allowed.');
|
||||
|
||||
// Put a test image in the files directory.
|
||||
$test_images = $this->getTestFiles('image');
|
||||
|
@ -152,8 +150,8 @@ class FilterHtmlImageSecureTest extends BrowserTestBase {
|
|||
$found = TRUE;
|
||||
if ($converted == $red_x_image) {
|
||||
$this->assertEquals($red_x_image, $element->getAttribute('src'));
|
||||
$this->assertEquals($alt_text, $element->getAttribute('alt'));
|
||||
$this->assertEquals($title_text, $element->getAttribute('title'));
|
||||
$this->assertEquals('Image removed.', $element->getAttribute('alt'));
|
||||
$this->assertEquals('This image has been removed. For security reasons, only images from the local domain are allowed.', $element->getAttribute('title'));
|
||||
$this->assertEquals('16', $element->getAttribute('height'));
|
||||
$this->assertEquals('16', $element->getAttribute('width'));
|
||||
}
|
||||
|
|
|
@ -584,14 +584,13 @@ class ForumTest extends BrowserTestBase {
|
|||
$this->drupalGet('node/add/forum', ['query' => ['forum_id' => $tid]]);
|
||||
$this->submitForm($edit, 'Save');
|
||||
|
||||
$type = t('Forum topic');
|
||||
if ($container) {
|
||||
$this->assertSession()->pageTextNotContains("$type $title has been created.");
|
||||
$this->assertSession()->pageTextNotContains("Forum topic $title has been created.");
|
||||
$this->assertSession()->pageTextContains("The item {$forum['name']} is a forum container, not a forum.");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$this->assertSession()->pageTextContains($type . ' ' . $title . ' has been created.');
|
||||
$this->assertSession()->pageTextContains("Forum topic $title has been created.");
|
||||
$this->assertSession()->pageTextNotContains("The item {$forum['name']} is a forum container, not a forum.");
|
||||
|
||||
// Verify that the creation message contains a link to a node.
|
||||
|
@ -644,8 +643,8 @@ class ForumTest extends BrowserTestBase {
|
|||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertSession()->titleEquals($node->label() . ' | Drupal');
|
||||
$breadcrumb_build = [
|
||||
Link::createFromRoute(t('Home'), '<front>'),
|
||||
Link::createFromRoute(t('Forums'), 'forum.index'),
|
||||
Link::createFromRoute('Home', '<front>'),
|
||||
Link::createFromRoute('Forums', 'forum.index'),
|
||||
Link::createFromRoute($this->forumContainer['name'], 'forum.page', ['taxonomy_term' => $this->forumContainer['tid']]),
|
||||
Link::createFromRoute($this->forum['name'], 'forum.page', ['taxonomy_term' => $this->forum['tid']]),
|
||||
];
|
||||
|
@ -708,8 +707,8 @@ class ForumTest extends BrowserTestBase {
|
|||
$this->assertSession()->titleEquals($forum['name'] . ' | Drupal');
|
||||
|
||||
$breadcrumb_build = [
|
||||
Link::createFromRoute(t('Home'), '<front>'),
|
||||
Link::createFromRoute(t('Forums'), 'forum.index'),
|
||||
Link::createFromRoute('Home', '<front>'),
|
||||
Link::createFromRoute('Forums', 'forum.index'),
|
||||
];
|
||||
if (isset($parent)) {
|
||||
$breadcrumb_build[] = Link::createFromRoute($parent['name'], 'forum.page', ['taxonomy_term' => $parent['tid']]);
|
||||
|
|
|
@ -45,7 +45,7 @@ class ForumUninstallTest extends BrowserTestBase {
|
|||
|
||||
// Create a taxonomy term.
|
||||
$term = Term::create([
|
||||
'name' => t('A term'),
|
||||
'name' => 'A term',
|
||||
'langcode' => \Drupal::languageManager()->getDefaultLanguage()->getId(),
|
||||
'description' => '',
|
||||
'parent' => [0],
|
||||
|
|
|
@ -437,7 +437,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
// Can't use fillField cause Mink can't fill hidden fields.
|
||||
$this->drupalGet("admin/structure/types/manage/article/fields/node.article.$field_name/storage");
|
||||
$this->getSession()->getPage()->find('css', 'input[name="settings[default_image][uuid][fids]"]')->setValue(0);
|
||||
$this->getSession()->getPage()->pressButton(t('Save field settings'));
|
||||
$this->getSession()->getPage()->pressButton('Save field settings');
|
||||
|
||||
// Clear field definition cache so the new default image is detected.
|
||||
\Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
|
||||
|
|
|
@ -56,7 +56,7 @@ class ImageFieldValidateTest extends ImageFieldTestBase {
|
|||
'entity_type' => 'node',
|
||||
'bundle' => 'article',
|
||||
'field_name' => 'field_dummy_select',
|
||||
'label' => t('Dummy select'),
|
||||
'label' => 'Dummy select',
|
||||
])->save();
|
||||
|
||||
\Drupal::entityTypeManager()
|
||||
|
|
|
@ -54,7 +54,7 @@ class ActionTest extends ResourceTestBase {
|
|||
$action = Action::create([
|
||||
'id' => 'user_add_role_action.' . RoleInterface::ANONYMOUS_ID,
|
||||
'type' => 'user',
|
||||
'label' => t('Add the anonymous role to the selected users'),
|
||||
'label' => 'Add the anonymous role to the selected users',
|
||||
'configuration' => [
|
||||
'rid' => RoleInterface::ANONYMOUS_ID,
|
||||
],
|
||||
|
|
|
@ -65,7 +65,7 @@ class ShortcutTest extends ResourceTestBase {
|
|||
protected function createEntity() {
|
||||
$shortcut = Shortcut::create([
|
||||
'shortcut_set' => 'default',
|
||||
'title' => t('Comments'),
|
||||
'title' => 'Comments',
|
||||
'weight' => -20,
|
||||
'link' => [
|
||||
'uri' => 'internal:/user/logout',
|
||||
|
|
|
@ -53,7 +53,7 @@ class ConfigurableLanguageManagerTest extends BrowserTestBase {
|
|||
// Create a page node type and make it translatable.
|
||||
NodeType::create([
|
||||
'type' => 'page',
|
||||
'name' => t('Page'),
|
||||
'name' => 'Page',
|
||||
])->save();
|
||||
|
||||
$config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'page');
|
||||
|
|
|
@ -40,7 +40,7 @@ class LanguageBreadcrumbTest extends BrowserTestBase {
|
|||
public function testBreadCrumbs() {
|
||||
// Prepare common base breadcrumb elements.
|
||||
$home = ['' => 'Home'];
|
||||
$admin = $home + ['admin' => t('Administration')];
|
||||
$admin = $home + ['admin' => 'Administration'];
|
||||
|
||||
$page = $this->getSession()->getPage();
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace Drupal\Tests\locale\Functional;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
|
||||
/**
|
||||
* Tests for the user interface of project interface translations.
|
||||
|
@ -97,12 +96,7 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
|
|||
$this->assertSession()->linkByHrefExists(Url::fromRoute('locale.translate_status')->toString());
|
||||
$this->drupalGet('admin/reports/translations');
|
||||
$this->assertSession()->pageTextContains('Missing translations for one project');
|
||||
$release_details = new FormattableMarkup('@module (@version). @info', [
|
||||
'@module' => 'Locale test translate',
|
||||
'@version' => '1.3-dev',
|
||||
'@info' => t('File not found at %local_path', ['%local_path' => 'core/modules/locale/tests/test.de.po']),
|
||||
]);
|
||||
$this->assertSession()->responseContains($release_details->__toString());
|
||||
$this->assertSession()->pageTextContains('Locale test translate (1.3-dev). File not found at core/modules/locale/tests/test.de.po');
|
||||
|
||||
// Override Drupal core translation status as 'no translations found'.
|
||||
$status = locale_translation_get_status();
|
||||
|
|
|
@ -582,7 +582,7 @@ class MediaSourceTest extends MediaKernelTestBase {
|
|||
$form_state->setValues([
|
||||
'label' => 'Test type',
|
||||
'id' => $source_plugin_id,
|
||||
'op' => t('Save'),
|
||||
'op' => 'Save',
|
||||
]);
|
||||
|
||||
/** @var \Drupal\Core\Entity\EntityFieldManagerInterface $field_manager */
|
||||
|
|
|
@ -41,7 +41,7 @@ class MenuLinkContentDeleteFormTest extends BrowserTestBase {
|
|||
// Add new menu item.
|
||||
$this->drupalGet('admin/structure/menu/manage/admin/add');
|
||||
$this->submitForm([
|
||||
'title[0][value]' => t('Front page'),
|
||||
'title[0][value]' => 'Front page',
|
||||
'link[0][uri]' => '<front>',
|
||||
], 'Save');
|
||||
$this->assertSession()->pageTextContains('The menu link has been saved.');
|
||||
|
|
|
@ -89,7 +89,7 @@ class MenuLinkContentFormTest extends BrowserTestBase {
|
|||
$this->assertSession()->pageTextContains('The location this menu link points to.');
|
||||
|
||||
$this->submitForm([
|
||||
'title[0][value]' => t('Front page'),
|
||||
'title[0][value]' => 'Front page',
|
||||
'link[0][uri]' => '<front>',
|
||||
], 'Save');
|
||||
$this->assertSession()->pageTextContains('The menu link has been saved.');
|
||||
|
@ -101,7 +101,7 @@ class MenuLinkContentFormTest extends BrowserTestBase {
|
|||
public function testMenuLinkContentFormValidation() {
|
||||
$this->drupalGet('admin/structure/menu/manage/admin/add');
|
||||
$this->submitForm([
|
||||
'title[0][value]' => t('Test page'),
|
||||
'title[0][value]' => 'Test page',
|
||||
'link[0][uri]' => '<test>',
|
||||
], 'Save');
|
||||
$this->assertSession()->pageTextContains('Manually entered paths should start with one of the following characters: / ? #');
|
||||
|
|
|
@ -74,13 +74,13 @@ class MenuUiContentModerationTest extends BrowserTestBase {
|
|||
// Publish the node with no changes.
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->submitForm([], 'Save');
|
||||
$this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()]));
|
||||
$this->assertSession()->pageTextContains("Page {$node->label()} has been updated.");
|
||||
|
||||
// Create a pending revision with no changes.
|
||||
$edit = ['moderation_state[0][state]' => 'draft'];
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()]));
|
||||
$this->assertSession()->pageTextContains("Page {$node->label()} has been updated.");
|
||||
|
||||
// Add a menu link and save a new default (published) revision.
|
||||
$edit = [
|
||||
|
@ -138,7 +138,7 @@ class MenuUiContentModerationTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()]));
|
||||
$this->assertSession()->pageTextContains("Page {$node->label()} has been updated.");
|
||||
|
||||
// Ensure the content was not immediately published.
|
||||
$this->assertSession()->linkExists('Test menu link');
|
||||
|
@ -164,7 +164,7 @@ class MenuUiContentModerationTest extends BrowserTestBase {
|
|||
$edit = ['moderation_state[0][state]' => 'published'];
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()]));
|
||||
$this->assertSession()->pageTextContains("Page {$node->label()} has been updated.");
|
||||
|
||||
// Add a menu link and save and create a new non-default (draft) revision
|
||||
// and ensure it's not immediately published.
|
||||
|
@ -175,7 +175,7 @@ class MenuUiContentModerationTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()]));
|
||||
$this->assertSession()->pageTextContains("Page {$node->label()} has been updated.");
|
||||
$this->assertSession()->linkNotExists('Second test menu link');
|
||||
|
||||
// Publish the content and ensure the new menu link shows up.
|
||||
|
@ -184,7 +184,7 @@ class MenuUiContentModerationTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()]));
|
||||
$this->assertSession()->pageTextContains("Page {$node->label()} has been updated.");
|
||||
$this->assertSession()->linkExists('Second test menu link');
|
||||
}
|
||||
|
||||
|
|
|
@ -146,16 +146,16 @@ class TestDrupal6SqlBase extends DrupalSqlBase {
|
|||
*/
|
||||
public function fields() {
|
||||
return [
|
||||
'filename' => t('The path of the primary file for this item.'),
|
||||
'name' => t('The name of the item; e.g. node.'),
|
||||
'type' => t('The type of the item, either module, theme, or theme_engine.'),
|
||||
'owner' => t("A theme's 'parent'. Can be either a theme or an engine."),
|
||||
'status' => t('Boolean indicating whether or not this item is enabled.'),
|
||||
'throttle' => t('Boolean indicating whether this item is disabled when the throttle.module disables throttleable items.'),
|
||||
'bootstrap' => t("Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted)."),
|
||||
'schema_version' => t("The module's database schema version number."),
|
||||
'weight' => t("The order in which this module's hooks should be invoked."),
|
||||
'info' => t("A serialized array containing information from the module's .info file."),
|
||||
'filename' => $this->t('The path of the primary file for this item.'),
|
||||
'name' => $this->t('The name of the item; e.g. node.'),
|
||||
'type' => $this->t('The type of the item, either module, theme, or theme_engine.'),
|
||||
'owner' => $this->t("A theme's 'parent'. Can be either a theme or an engine."),
|
||||
'status' => $this->t('Boolean indicating whether or not this item is enabled.'),
|
||||
'throttle' => $this->t('Boolean indicating whether this item is disabled when the throttle.module disables throttleable items.'),
|
||||
'bootstrap' => $this->t("Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted)."),
|
||||
'schema_version' => $this->t("The module's database schema version number."),
|
||||
'weight' => $this->t("The order in which this module's hooks should be invoked."),
|
||||
'info' => $this->t("A serialized array containing information from the module's .info file."),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ class SourceProviderTest extends MigrateUpgradeTestBase {
|
|||
$this->submitCredentialForm();
|
||||
|
||||
// Ensure we get errors about missing modules.
|
||||
$session->pageTextContains(t('Resolve all issues below to continue the upgrade.'));
|
||||
$session->pageTextContains(t('The no_source_module plugin must define the source_module property.'));
|
||||
$session->pageTextContains('Resolve all issues below to continue the upgrade.');
|
||||
$session->pageTextContains('The no_source_module plugin must define the source_module property.');
|
||||
|
||||
// Uninstall the module causing the missing module error messages.
|
||||
$this->container->get('module_installer')
|
||||
|
@ -45,10 +45,10 @@ class SourceProviderTest extends MigrateUpgradeTestBase {
|
|||
$this->submitForm($this->edits, 'Review upgrade');
|
||||
|
||||
// Ensure there are no errors about missing modules from the test module.
|
||||
$session->pageTextNotContains(t('Source module not found for migration_provider_no_annotation.'));
|
||||
$session->pageTextNotContains(t('Source module not found for migration_provider_test.'));
|
||||
$session->pageTextNotContains('Source module not found for migration_provider_no_annotation.');
|
||||
$session->pageTextNotContains('Source module not found for migration_provider_test.');
|
||||
// Ensure there are no errors about any other missing migration providers.
|
||||
$session->pageTextNotContains(t('module not found'));
|
||||
$session->pageTextNotContains('module not found');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -108,7 +108,7 @@ class NodeAccessBaseTableTest extends NodeTestBase {
|
|||
$this->drupalLogin($this->webUser);
|
||||
foreach ([0 => 'Public', 1 => 'Private'] as $is_private => $type) {
|
||||
$edit = [
|
||||
'title[0][value]' => t('@private_public Article created by @user', ['@private_public' => $type, '@user' => $this->webUser->getAccountName()]),
|
||||
'title[0][value]' => "$type Article created by " . $this->webUser->getAccountName(),
|
||||
];
|
||||
if ($is_private) {
|
||||
$edit['private[0][value]'] = TRUE;
|
||||
|
|
|
@ -32,7 +32,7 @@ class NodeAccessPagerTest extends BrowserTestBase {
|
|||
parent::setUp();
|
||||
|
||||
node_access_rebuild();
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => t('Basic page')]);
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
$this->addDefaultCommentField('node', 'page');
|
||||
$this->webUser = $this->drupalCreateUser([
|
||||
'access content',
|
||||
|
|
|
@ -37,8 +37,8 @@ class NodeEntityViewModeAlterTest extends NodeTestBase {
|
|||
// Create a node.
|
||||
$edit = [];
|
||||
$edit['title[0][value]'] = $this->randomMachineName(8);
|
||||
$edit['body[0][value]'] = t('Data that should appear only in the body for the node.');
|
||||
$edit['body[0][summary]'] = t('Extra data that should appear only in the teaser for the node.');
|
||||
$edit['body[0][value]'] = 'Data that should appear only in the body for the node.';
|
||||
$edit['body[0][summary]'] = 'Extra data that should appear only in the teaser for the node.';
|
||||
$this->drupalGet('node/add/page');
|
||||
$this->submitForm($edit, 'Save');
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class NodeRSSContentTest extends NodeTestBase {
|
|||
$this->assertSession()->responseNotContains($non_rss_content);
|
||||
|
||||
// Check that extra RSS elements and namespaces are added to RSS feed.
|
||||
$test_element = '<testElement>' . t('Value of testElement RSS element for node @nid.', ['@nid' => $node->id()]) . '</testElement>';
|
||||
$test_element = "<testElement>Value of testElement RSS element for node {$node->id()}.</testElement>";
|
||||
$test_ns = 'xmlns:drupaltest="http://example.com/test-namespace"';
|
||||
$this->assertSession()->responseContains($test_element);
|
||||
$this->assertSession()->responseContains($test_ns);
|
||||
|
|
|
@ -456,7 +456,7 @@ class NodeTranslationUITest extends ContentTranslationUITestBase {
|
|||
if (!$entity->isNew() && $entity->isTranslatable()) {
|
||||
$translations = $entity->getTranslationLanguages();
|
||||
if ((count($translations) > 1 || !isset($translations[$langcode])) && ($field = $entity->getFieldDefinition('status'))) {
|
||||
return ' ' . ($field->isTranslatable() ? t('(this translation)') : t('(all translations)'));
|
||||
return ' ' . ($field->isTranslatable() ? '(this translation)' : '(all translations)');
|
||||
}
|
||||
}
|
||||
return '';
|
||||
|
|
|
@ -68,7 +68,7 @@ class FilterNodeAccessTest extends NodeTestBase {
|
|||
'format' => filter_default_format(),
|
||||
],
|
||||
],
|
||||
'title' => t('@private_public Article created by @user', ['@private_public' => $type, '@user' => $web_user->getAccountName()]),
|
||||
'title' => "$type Article created by " . $web_user->getAccountName(),
|
||||
'type' => 'article',
|
||||
'uid' => $web_user->id(),
|
||||
'private' => (bool) $is_private,
|
||||
|
|
|
@ -28,7 +28,7 @@ class PathTaxonomyTermTest extends PathTestBase {
|
|||
|
||||
// Create a Tags vocabulary for the Article node type.
|
||||
$vocabulary = Vocabulary::create([
|
||||
'name' => t('Tags'),
|
||||
'name' => 'Tags',
|
||||
'vid' => 'tags',
|
||||
]);
|
||||
$vocabulary->save();
|
||||
|
|
|
@ -77,7 +77,7 @@ class QuickEditCustomPipelineTest extends BrowserTestBase {
|
|||
'body[0][summary]' => '',
|
||||
'body[0][value]' => '<p>Fine thanks.</p>',
|
||||
'body[0][format]' => 'filtered_html',
|
||||
'op' => t('Save'),
|
||||
'op' => 'Save',
|
||||
];
|
||||
// Assume there is another field on this page, which doesn't use a custom
|
||||
// render pipeline, but the default one, and it uses the "full" view mode.
|
||||
|
|
|
@ -61,7 +61,7 @@ class QuickEditEndPointAccessTest extends BrowserTestBase {
|
|||
$edit['body[0][summary]'] = '';
|
||||
$edit['body[0][value]'] = '<p>Malicious content.</p>';
|
||||
$edit['body[0][format]'] = 'filtered_html';
|
||||
$edit['op'] = t('Save');
|
||||
$edit['op'] = 'Save';
|
||||
$this->assertAccessIsBlocked($url, $edit);
|
||||
|
||||
$post = ['nocssjs' => 'true'];
|
||||
|
|
|
@ -83,7 +83,7 @@ class QuickEditImageControllerTest extends BrowserTestBase {
|
|||
// Create a test Node.
|
||||
$node = $this->drupalCreateNode([
|
||||
'type' => 'article',
|
||||
'title' => t('Test Node'),
|
||||
'title' => 'Test Node',
|
||||
]);
|
||||
$this->drupalGet('quickedit/image/info/node/' . $node->id() . '/' . $this->fieldName . '/' . $node->language()->getId() . '/default');
|
||||
$this->assertSession()->statusCodeEquals(403);
|
||||
|
@ -101,7 +101,7 @@ class QuickEditImageControllerTest extends BrowserTestBase {
|
|||
// Create a test Node.
|
||||
$node = $this->drupalCreateNode([
|
||||
'type' => 'article',
|
||||
'title' => t('Test Node'),
|
||||
'title' => 'Test Node',
|
||||
]);
|
||||
$json = $this->drupalGet('quickedit/image/info/node/' . $node->id() . '/' . $this->fieldName . '/' . $node->language()->getId() . '/default', ['query' => ['_format' => 'json']]);
|
||||
$info = Json::decode($json);
|
||||
|
@ -118,7 +118,7 @@ class QuickEditImageControllerTest extends BrowserTestBase {
|
|||
// Create a test Node.
|
||||
$node = $this->drupalCreateNode([
|
||||
'type' => 'article',
|
||||
'title' => t('Test Node'),
|
||||
'title' => 'Test Node',
|
||||
]);
|
||||
|
||||
// We want a test image that is a valid size.
|
||||
|
@ -145,7 +145,7 @@ class QuickEditImageControllerTest extends BrowserTestBase {
|
|||
// Create a test Node.
|
||||
$node = $this->drupalCreateNode([
|
||||
'type' => 'article',
|
||||
'title' => t('Test Node'),
|
||||
'title' => 'Test Node',
|
||||
]);
|
||||
|
||||
// We want a test image that will fail validation.
|
||||
|
|
|
@ -70,7 +70,7 @@ class LayoutBuilderQuickEditTest extends QuickEditJavascriptTestBase {
|
|||
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
|
||||
$this->article = $this->drupalCreateNode([
|
||||
'type' => 'article',
|
||||
'title' => t('My Test Node'),
|
||||
'title' => 'My Test Node',
|
||||
'body' => [
|
||||
'value' => 'Hello Layout Builder!',
|
||||
'format' => 'plain_text',
|
||||
|
|
|
@ -70,7 +70,7 @@ class QuickEditFileTest extends QuickEditJavascriptTestBase {
|
|||
// Create test node.
|
||||
$node = $this->drupalCreateNode([
|
||||
'type' => 'article',
|
||||
'title' => t('My Test Node'),
|
||||
'title' => 'My Test Node',
|
||||
'field_file' => [
|
||||
'target_id' => $file->id(),
|
||||
],
|
||||
|
|
|
@ -104,7 +104,7 @@ class QuickEditImageTest extends QuickEditJavascriptTestBase {
|
|||
$image = $image_factory->get($valid_images[0]->uri);
|
||||
$node = $this->drupalCreateNode([
|
||||
'type' => 'article',
|
||||
'title' => t('Test Node'),
|
||||
'title' => 'Test Node',
|
||||
$field_name => [
|
||||
'target_id' => $file->id(),
|
||||
'alt' => 'Hello world',
|
||||
|
|
|
@ -127,7 +127,7 @@ class QuickEditIntegrationTest extends QuickEditJavascriptTestBase {
|
|||
|
||||
$node = $this->drupalCreateNode([
|
||||
'type' => 'article',
|
||||
'title' => t('My Test Node'),
|
||||
'title' => 'My Test Node',
|
||||
'body' => [
|
||||
'value' => '<p>Hello world!</p><p>I do not know what to say…</p><p>I wish I were eloquent.</p>',
|
||||
'format' => 'some_format',
|
||||
|
|
|
@ -354,7 +354,7 @@ class QuickEditLoadingTest extends WebDriverTestBase {
|
|||
FieldConfig::create([
|
||||
'field_name' => 'field_image',
|
||||
'field_type' => 'image',
|
||||
'label' => t('Image'),
|
||||
'label' => 'Image',
|
||||
'entity_type' => 'node',
|
||||
'bundle' => 'article',
|
||||
])->save();
|
||||
|
|
|
@ -54,7 +54,7 @@ class ShortcutCacheTagsTest extends EntityCacheTagsTestBase {
|
|||
// Create a "Llama" shortcut.
|
||||
$shortcut = Shortcut::create([
|
||||
'shortcut_set' => 'default',
|
||||
'title' => t('Llama'),
|
||||
'title' => 'Llama',
|
||||
'weight' => 0,
|
||||
'link' => [['uri' => 'internal:/admin']],
|
||||
]);
|
||||
|
|
|
@ -36,7 +36,7 @@ class StatisticsTokenReplaceTest extends StatisticsTestBase {
|
|||
$tests = [];
|
||||
$tests['[node:total-count]'] = 0;
|
||||
$tests['[node:day-count]'] = 0;
|
||||
$tests['[node:last-view]'] = t('never');
|
||||
$tests['[node:last-view]'] = 'never';
|
||||
$tests['[node:last-view:short]'] = $date_formatter->format($request_time, 'short');
|
||||
|
||||
foreach ($tests as $input => $expected) {
|
||||
|
|
|
@ -24,10 +24,10 @@ class SelectTableSortDefaultTest extends DatabaseTestBase {
|
|||
*/
|
||||
public function testTableSortQuery() {
|
||||
$sorts = [
|
||||
['field' => t('Task ID'), 'sort' => 'desc', 'first' => 'perform at superbowl', 'last' => 'eat'],
|
||||
['field' => t('Task ID'), 'sort' => 'asc', 'first' => 'eat', 'last' => 'perform at superbowl'],
|
||||
['field' => t('Task'), 'sort' => 'asc', 'first' => 'code', 'last' => 'sleep'],
|
||||
['field' => t('Task'), 'sort' => 'desc', 'first' => 'sleep', 'last' => 'code'],
|
||||
['field' => 'Task ID', 'sort' => 'desc', 'first' => 'perform at superbowl', 'last' => 'eat'],
|
||||
['field' => 'Task ID', 'sort' => 'asc', 'first' => 'eat', 'last' => 'perform at superbowl'],
|
||||
['field' => 'Task', 'sort' => 'asc', 'first' => 'code', 'last' => 'sleep'],
|
||||
['field' => 'Task', 'sort' => 'desc', 'first' => 'sleep', 'last' => 'code'],
|
||||
// more elements here
|
||||
|
||||
];
|
||||
|
@ -52,10 +52,10 @@ class SelectTableSortDefaultTest extends DatabaseTestBase {
|
|||
*/
|
||||
public function testTableSortQueryFirst() {
|
||||
$sorts = [
|
||||
['field' => t('Task ID'), 'sort' => 'desc', 'first' => 'perform at superbowl', 'last' => 'eat'],
|
||||
['field' => t('Task ID'), 'sort' => 'asc', 'first' => 'eat', 'last' => 'perform at superbowl'],
|
||||
['field' => t('Task'), 'sort' => 'asc', 'first' => 'code', 'last' => 'sleep'],
|
||||
['field' => t('Task'), 'sort' => 'desc', 'first' => 'sleep', 'last' => 'code'],
|
||||
['field' => 'Task ID', 'sort' => 'desc', 'first' => 'perform at superbowl', 'last' => 'eat'],
|
||||
['field' => 'Task ID', 'sort' => 'asc', 'first' => 'eat', 'last' => 'perform at superbowl'],
|
||||
['field' => 'Task', 'sort' => 'asc', 'first' => 'code', 'last' => 'sleep'],
|
||||
['field' => 'Task', 'sort' => 'desc', 'first' => 'sleep', 'last' => 'code'],
|
||||
// more elements here
|
||||
|
||||
];
|
||||
|
|
|
@ -216,7 +216,7 @@ class ElementsTableSelectTest extends BrowserTestBase {
|
|||
$form_id = $this->randomMachineName();
|
||||
$form_state = new FormState();
|
||||
|
||||
$form['op'] = ['#type' => 'submit', '#value' => t('Submit')];
|
||||
$form['op'] = ['#type' => 'submit', '#value' => 'Submit'];
|
||||
// The form token CSRF protection should not interfere with this test, so we
|
||||
// bypass it by setting the token to FALSE.
|
||||
$form['#token'] = FALSE;
|
||||
|
|
|
@ -85,7 +85,7 @@ class FormTest extends BrowserTestBase {
|
|||
$elements['textarea']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'textarea'];
|
||||
$elements['textarea']['empty_values'] = $empty_strings;
|
||||
|
||||
$elements['radios']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'radios', '#options' => ['' => t('None'), $this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()]];
|
||||
$elements['radios']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'radios', '#options' => ['' => 'None', $this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()]];
|
||||
$elements['radios']['empty_values'] = $empty_arrays;
|
||||
|
||||
$elements['checkbox']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'checkbox', '#required' => TRUE];
|
||||
|
@ -94,7 +94,7 @@ class FormTest extends BrowserTestBase {
|
|||
$elements['checkboxes']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'checkboxes', '#options' => [$this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()]];
|
||||
$elements['checkboxes']['empty_values'] = $empty_arrays;
|
||||
|
||||
$elements['select']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'select', '#options' => ['' => t('None'), $this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()]];
|
||||
$elements['select']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'select', '#options' => ['' => 'None', $this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()]];
|
||||
$elements['select']['empty_values'] = $empty_strings;
|
||||
|
||||
$elements['file']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'file'];
|
||||
|
@ -109,7 +109,7 @@ class FormTest extends BrowserTestBase {
|
|||
$form_id = $this->randomMachineName();
|
||||
$form = [];
|
||||
$form_state = new FormState();
|
||||
$form['op'] = ['#type' => 'submit', '#value' => t('Submit')];
|
||||
$form['op'] = ['#type' => 'submit', '#value' => 'Submit'];
|
||||
$element = $data['element']['#title'];
|
||||
$form[$element] = $data['element'];
|
||||
$form[$element]['#required'] = $required;
|
||||
|
@ -185,7 +185,7 @@ class FormTest extends BrowserTestBase {
|
|||
$expected[] = $form[$key]['#form_test_required_error'];
|
||||
}
|
||||
else {
|
||||
$expected[] = t('@name field is required.', ['@name' => $form[$key]['#title']]);
|
||||
$expected[] = $form[$key]['#title'] . ' field is required.';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class LanguageSelectElementTest extends BrowserTestBase {
|
|||
/** @var \Drupal\Core\Language\LanguageManagerInterface $language_manager */
|
||||
$language_manager = $this->container->get('language_manager');
|
||||
foreach ($language_manager->getLanguages($flags) as $langcode => $language) {
|
||||
$options[$langcode] = $language->isLocked() ? t('- @name -', ['@name' => $language->getName()]) : $language->getName();
|
||||
$options[$langcode] = $language->isLocked() ? "- {$language->getName()} -" : $language->getName();
|
||||
}
|
||||
$this->_testLanguageSelectElementOptions($id, $options);
|
||||
}
|
||||
|
|
|
@ -68,62 +68,62 @@ class BreadcrumbTest extends BrowserTestBase {
|
|||
public function testBreadCrumbs() {
|
||||
// Prepare common base breadcrumb elements.
|
||||
$home = ['' => 'Home'];
|
||||
$admin = $home + ['admin' => t('Administration')];
|
||||
$config = $admin + ['admin/config' => t('Configuration')];
|
||||
$admin = $home + ['admin' => 'Administration'];
|
||||
$config = $admin + ['admin/config' => 'Configuration'];
|
||||
$type = 'article';
|
||||
|
||||
// Verify Taxonomy administration breadcrumbs.
|
||||
$trail = $admin + [
|
||||
'admin/structure' => t('Structure'),
|
||||
'admin/structure' => 'Structure',
|
||||
];
|
||||
$this->assertBreadcrumb('admin/structure/taxonomy', $trail);
|
||||
|
||||
$trail += [
|
||||
'admin/structure/taxonomy' => t('Taxonomy'),
|
||||
'admin/structure/taxonomy' => 'Taxonomy',
|
||||
];
|
||||
$this->assertBreadcrumb('admin/structure/taxonomy/manage/tags', $trail);
|
||||
$trail += [
|
||||
'admin/structure/taxonomy/manage/tags' => t('Edit Tags'),
|
||||
'admin/structure/taxonomy/manage/tags' => 'Edit Tags',
|
||||
];
|
||||
$this->assertBreadcrumb('admin/structure/taxonomy/manage/tags/overview', $trail);
|
||||
$this->assertBreadcrumb('admin/structure/taxonomy/manage/tags/add', $trail);
|
||||
|
||||
// Verify Menu administration breadcrumbs.
|
||||
$trail = $admin + [
|
||||
'admin/structure' => t('Structure'),
|
||||
'admin/structure' => 'Structure',
|
||||
];
|
||||
$this->assertBreadcrumb('admin/structure/menu', $trail);
|
||||
|
||||
$trail += [
|
||||
'admin/structure/menu' => t('Menus'),
|
||||
'admin/structure/menu' => 'Menus',
|
||||
];
|
||||
$this->assertBreadcrumb('admin/structure/menu/manage/tools', $trail);
|
||||
|
||||
$trail += [
|
||||
'admin/structure/menu/manage/tools' => t('Tools'),
|
||||
'admin/structure/menu/manage/tools' => 'Tools',
|
||||
];
|
||||
$this->assertBreadcrumb("admin/structure/menu/link/node.add_page/edit", $trail);
|
||||
$this->assertBreadcrumb('admin/structure/menu/manage/tools/add', $trail);
|
||||
|
||||
// Verify Node administration breadcrumbs.
|
||||
$trail = $admin + [
|
||||
'admin/structure' => t('Structure'),
|
||||
'admin/structure/types' => t('Content types'),
|
||||
'admin/structure' => 'Structure',
|
||||
'admin/structure/types' => 'Content types',
|
||||
];
|
||||
$this->assertBreadcrumb('admin/structure/types/add', $trail);
|
||||
$this->assertBreadcrumb("admin/structure/types/manage/$type", $trail);
|
||||
$trail += [
|
||||
"admin/structure/types/manage/$type" => t('Article'),
|
||||
"admin/structure/types/manage/$type" => 'Article',
|
||||
];
|
||||
$this->assertBreadcrumb("admin/structure/types/manage/$type/fields", $trail);
|
||||
$this->assertBreadcrumb("admin/structure/types/manage/$type/display", $trail);
|
||||
$trail_teaser = $trail + [
|
||||
"admin/structure/types/manage/$type/display" => t('Manage display'),
|
||||
"admin/structure/types/manage/$type/display" => 'Manage display',
|
||||
];
|
||||
$this->assertBreadcrumb("admin/structure/types/manage/$type/display/teaser", $trail_teaser);
|
||||
$this->assertBreadcrumb("admin/structure/types/manage/$type/delete", $trail);
|
||||
$trail += [
|
||||
"admin/structure/types/manage/$type/fields" => t('Manage fields'),
|
||||
"admin/structure/types/manage/$type/fields" => 'Manage fields',
|
||||
];
|
||||
$this->assertBreadcrumb("admin/structure/types/manage/$type/fields/node.$type.body", $trail);
|
||||
|
||||
|
@ -132,12 +132,12 @@ class BreadcrumbTest extends BrowserTestBase {
|
|||
$format = reset($filter_formats);
|
||||
$format_id = $format->id();
|
||||
$trail = $config + [
|
||||
'admin/config/content' => t('Content authoring'),
|
||||
'admin/config/content' => 'Content authoring',
|
||||
];
|
||||
$this->assertBreadcrumb('admin/config/content/formats', $trail);
|
||||
|
||||
$trail += [
|
||||
'admin/config/content/formats' => t('Text formats and editors'),
|
||||
'admin/config/content/formats' => 'Text formats and editors',
|
||||
];
|
||||
$this->assertBreadcrumb('admin/config/content/formats/add', $trail);
|
||||
$this->assertBreadcrumb("admin/config/content/formats/manage/$format_id", $trail);
|
||||
|
@ -379,7 +379,7 @@ class BreadcrumbTest extends BrowserTestBase {
|
|||
$this->assertSession()->statusCodeNotEquals(403);
|
||||
|
||||
// Since the Reports page is accessible, that will show.
|
||||
$trail += ['admin/reports' => t('Reports')];
|
||||
$trail += ['admin/reports' => 'Reports'];
|
||||
$this->assertBreadcrumb('admin/reports/dblog', $trail, 'Recent log messages');
|
||||
$this->assertSession()->statusCodeNotEquals(403);
|
||||
|
||||
|
@ -395,7 +395,7 @@ class BreadcrumbTest extends BrowserTestBase {
|
|||
public function testAssertBreadcrumbTrait() {
|
||||
// Ensure the test trait works as expected using menu_test routes.
|
||||
$home = ['' => 'Home'];
|
||||
$trail = $home + ['menu-test' => t('Menu test root')];
|
||||
$trail = $home + ['menu-test' => 'Menu test root'];
|
||||
|
||||
// Test a passing assertion.
|
||||
$this->assertBreadcrumb('menu-test/breadcrumb1', $trail);
|
||||
|
|
|
@ -54,12 +54,12 @@ class SiteMaintenanceTest extends BrowserTestBase {
|
|||
public function testSiteMaintenance() {
|
||||
|
||||
// Verify that permission message is displayed.
|
||||
$permission_handler = $this->container->get('user.permissions');
|
||||
$permissions = $permission_handler->getPermissions();
|
||||
$permission_label = $permissions['access site in maintenance mode']['title'];
|
||||
$permission_message = t('Visitors will only see the maintenance mode message. Only users with the "@permission-label" <a href=":permissions-url">permission</a> will be able to access the site. Authorized users can log in directly via the <a href=":user-login">user login</a> page.', ['@permission-label' => $permission_label, ':permissions-url' => Url::fromRoute('user.admin_permissions')->toString(), ':user-login' => Url::fromRoute('user.login')->toString()]);
|
||||
$this->drupalGet(Url::fromRoute('system.site_maintenance_mode'));
|
||||
$this->assertSession()->responseContains($permission_message);
|
||||
$this->assertSession()->pageTextContains('Visitors will only see the maintenance mode message. Only users with the "Use the site in maintenance mode" permission will be able to access the site. Authorized users can log in directly via the user login page.');
|
||||
$this->assertSession()->linkExists('permission');
|
||||
$this->assertSession()->linkByHrefExists(Url::fromRoute('user.admin_permissions')->toString());
|
||||
$this->assertSession()->linkExists('user login');
|
||||
$this->assertSession()->linkByHrefExists(Url::fromRoute('user.login')->toString());
|
||||
|
||||
$this->drupalGet(Url::fromRoute('user.page'));
|
||||
// JS should be aggregated, so drupal.js is not in the page source.
|
||||
|
@ -72,7 +72,7 @@ class SiteMaintenanceTest extends BrowserTestBase {
|
|||
$this->drupalGet('admin/config/development/maintenance');
|
||||
$this->submitForm($edit, 'Save configuration');
|
||||
|
||||
$admin_message = t('Operating in maintenance mode. <a href=":url">Go online.</a>', [':url' => Url::fromRoute('system.site_maintenance_mode')->toString()]);
|
||||
$admin_message = 'Operating in maintenance mode. Go online.';
|
||||
$user_message = 'Operating in maintenance mode.';
|
||||
$offline_message = $this->config('system.site')->get('name') . ' is currently under maintenance. We should be back shortly. Thank you for your patience.';
|
||||
|
||||
|
@ -80,7 +80,9 @@ class SiteMaintenanceTest extends BrowserTestBase {
|
|||
// JS should not be aggregated, so drupal.js is expected in the page source.
|
||||
$links = $this->xpath('//script[contains(@src, :href)]', [':href' => '/core/misc/drupal.js']);
|
||||
$this->assertTrue(isset($links[0]), 'script /core/misc/drupal.js in page');
|
||||
$this->assertSession()->responseContains($admin_message);
|
||||
$this->assertSession()->pageTextContains($admin_message);
|
||||
$this->assertSession()->linkExists('Go online.');
|
||||
$this->assertSession()->linkByHrefExists(Url::fromRoute('system.site_maintenance_mode')->toString());
|
||||
|
||||
// Logout and verify that offline message is displayed.
|
||||
$this->drupalLogout();
|
||||
|
@ -113,7 +115,7 @@ class SiteMaintenanceTest extends BrowserTestBase {
|
|||
$this->drupalLogout();
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->drupalGet('admin/config/development/maintenance');
|
||||
$this->assertSession()->responseNotContains($admin_message);
|
||||
$this->assertSession()->pageTextNotContains($admin_message);
|
||||
|
||||
$offline_message = 'Sorry, not online.';
|
||||
$edit = [
|
||||
|
|
|
@ -80,7 +80,7 @@ class ActionTest extends KernelTestBase {
|
|||
$action = Action::create([
|
||||
'id' => 'user_add_role_action.' . RoleInterface::ANONYMOUS_ID,
|
||||
'type' => 'user',
|
||||
'label' => t('Add the anonymous role to the selected users'),
|
||||
'label' => 'Add the anonymous role to the selected users',
|
||||
'configuration' => [
|
||||
'rid' => RoleInterface::ANONYMOUS_ID,
|
||||
],
|
||||
|
|
|
@ -76,7 +76,7 @@ class ProgrammaticTest extends KernelTestBase {
|
|||
$valid_form = empty($errors);
|
||||
$args = [
|
||||
'%values' => print_r($values, TRUE),
|
||||
'%errors' => $valid_form ? t('None') : implode(' ', $errors),
|
||||
'%errors' => $valid_form ? 'None' : implode(' ', $errors),
|
||||
];
|
||||
$this->assertSame($valid_form, $valid_input, new FormattableMarkup('Input values: %values<br />Validation handler errors: %errors', $args));
|
||||
|
||||
|
|
|
@ -73,8 +73,9 @@ class VocabularyPermissionsTest extends TaxonomyTestBase {
|
|||
$this->createTerm($vocabulary1);
|
||||
|
||||
// Assert expected help texts on first vocabulary.
|
||||
$edit_help_text = t('You can reorganize the terms in @capital_name using their drag-and-drop handles, and group terms under a parent term by sliding them under and to the right of the parent.', ['@capital_name' => Unicode::ucfirst($vocabulary1->label())]);
|
||||
$no_edit_help_text = t('@capital_name contains the following terms.', ['@capital_name' => Unicode::ucfirst($vocabulary1->label())]);
|
||||
$vocabulary1_label = Unicode::ucfirst($vocabulary1->label());
|
||||
$edit_help_text = "You can reorganize the terms in $vocabulary1_label using their drag-and-drop handles, and group terms under a parent term by sliding them under and to the right of the parent.";
|
||||
$no_edit_help_text = "$vocabulary1_label contains the following terms.";
|
||||
|
||||
$assert_session = $this->assertSession();
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class VocabularyTranslationTest extends TaxonomyTestBase {
|
|||
$edit['langcode'] = 'en';
|
||||
$edit['vid'] = $vid;
|
||||
$edit['default_language[content_translation]'] = TRUE;
|
||||
$this->submitForm($edit, t('Save'));
|
||||
$this->submitForm($edit, 'Save');
|
||||
|
||||
$langcode = $this->additionalLangcodes[0];
|
||||
$vid_name = $edit['name'];
|
||||
|
@ -100,7 +100,7 @@ class VocabularyTranslationTest extends TaxonomyTestBase {
|
|||
$this->drupalGet("admin/structure/taxonomy/manage/$vid/translate/$langcode/add");
|
||||
|
||||
// Translate the name label.
|
||||
$this->submitForm(["translation[config_names][taxonomy.vocabulary.$vid][name]" => $translated_vid_name], t('Save translation'));
|
||||
$this->submitForm(["translation[config_names][taxonomy.vocabulary.$vid][name]" => $translated_vid_name], 'Save translation');
|
||||
|
||||
// Assert that the right name label is displayed on the taxonomy term
|
||||
// overview page.
|
||||
|
|
|
@ -50,7 +50,7 @@ class TrackerNodeAccessTest extends BrowserTestBase {
|
|||
// queries run for the anonymous user will miss it.
|
||||
$author = $this->drupalCreateUser();
|
||||
$private_node = $this->drupalCreateNode([
|
||||
'title' => t('Private node test'),
|
||||
'title' => 'Private node test',
|
||||
'private' => TRUE,
|
||||
'uid' => $author->id(),
|
||||
]);
|
||||
|
@ -85,11 +85,11 @@ class TrackerNodeAccessTest extends BrowserTestBase {
|
|||
|
||||
// Create some nodes.
|
||||
$private_node = $this->drupalCreateNode([
|
||||
'title' => t('Private node test'),
|
||||
'title' => 'Private node test',
|
||||
'private' => TRUE,
|
||||
]);
|
||||
$public_node = $this->drupalCreateNode([
|
||||
'title' => t('Public node test'),
|
||||
'title' => 'Public node test',
|
||||
'private' => FALSE,
|
||||
]);
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class UserAdminTest extends BrowserTestBase {
|
|||
$this->assertSession()->pageTextContains($admin_user->getAccountName());
|
||||
|
||||
// Test for existence of edit link in table.
|
||||
$link = $user_a->toLink(t('Edit'), 'edit-form', ['query' => ['destination' => $user_a->toUrl('collection')->toString()]])->toString();
|
||||
$link = $user_a->toLink('Edit', 'edit-form', ['query' => ['destination' => $user_a->toUrl('collection')->toString()]])->toString();
|
||||
$this->assertSession()->responseContains($link);
|
||||
|
||||
// Test exposed filter elements.
|
||||
|
|
|
@ -61,7 +61,7 @@ class UserCreateTest extends BrowserTestBase {
|
|||
'entity_type' => 'user',
|
||||
'label' => 'Picture',
|
||||
'bundle' => 'user',
|
||||
'description' => t('Your virtual face or picture.'),
|
||||
'description' => 'Your virtual face or picture.',
|
||||
'required' => FALSE,
|
||||
'settings' => [
|
||||
'file_extensions' => 'png gif jpg jpeg',
|
||||
|
|
|
@ -490,7 +490,7 @@ class UserPasswordResetTest extends BrowserTestBase {
|
|||
public function assertValidPasswordReset($name) {
|
||||
$this->assertSession()->pageTextContains("If $name is a valid account, an email will be sent with instructions to reset your password.");
|
||||
$this->assertMail('to', $this->account->getEmail(), 'Password e-mail sent to user.');
|
||||
$subject = t('Replacement login information for @username at @site', ['@username' => $this->account->getAccountName(), '@site' => \Drupal::config('system.site')->get('name')]);
|
||||
$subject = 'Replacement login information for ' . $this->account->getAccountName() . ' at Drupal';
|
||||
$this->assertMail('subject', $subject, 'Password reset e-mail subject is correct.');
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class UserTokenReplaceTest extends BrowserTestBase {
|
|||
// Generate tokens for the anonymous user.
|
||||
$anonymous_user = User::load(0);
|
||||
$tests = [];
|
||||
$tests['[user:uid]'] = t('not yet assigned');
|
||||
$tests['[user:uid]'] = 'not yet assigned';
|
||||
$tests['[user:display-name]'] = $anonymous_user->getDisplayName();
|
||||
|
||||
$base_bubbleable_metadata = BubbleableMetadata::createFromObject($anonymous_user);
|
||||
|
|
|
@ -94,7 +94,7 @@ class RegistrationWithUserFieldsTest extends WebDriverTestBase {
|
|||
$this->page->fillField('edit-mail', $name . '@example.com');
|
||||
|
||||
$this->page->pressButton('edit-submit');
|
||||
$this->webAssert->pageTextContains(t('@name field is required.', ['@name' => $field->label()]));
|
||||
$this->webAssert->pageTextContains($field->label() . ' field is required.');
|
||||
|
||||
// Invalid input.
|
||||
$this->page->fillField('edit-test-user-field-0-value', '-1');
|
||||
|
|
|
@ -34,12 +34,12 @@ class HandlerFieldPermissionTest extends UserKernelTestBase {
|
|||
$expected_permissions = [];
|
||||
$expected_permissions[$this->users[0]->id()] = [];
|
||||
$expected_permissions[$this->users[1]->id()] = [];
|
||||
$expected_permissions[$this->users[2]->id()][] = t('Administer roles and permissions');
|
||||
$expected_permissions[$this->users[2]->id()][] = 'Administer roles and permissions';
|
||||
// View user profiles comes first, because we sort by the permission
|
||||
// machine name.
|
||||
$expected_permissions[$this->users[3]->id()][] = t('View user information');
|
||||
$expected_permissions[$this->users[3]->id()][] = t('Administer roles and permissions');
|
||||
$expected_permissions[$this->users[3]->id()][] = t('Administer users');
|
||||
$expected_permissions[$this->users[3]->id()][] = 'View user information';
|
||||
$expected_permissions[$this->users[3]->id()][] = 'Administer roles and permissions';
|
||||
$expected_permissions[$this->users[3]->id()][] = 'Administer users';
|
||||
|
||||
foreach ($view->result as $index => $row) {
|
||||
$uid = $view->field['uid']->getValue($row);
|
||||
|
|
|
@ -79,41 +79,41 @@ class HandlerTest extends ViewTestBase {
|
|||
|
||||
// Test ors
|
||||
$handler = HandlerBase::breakString('word1 word2+word');
|
||||
$this->assertEqualValue(['word1', 'word2', 'word'], $handler);
|
||||
$this->assertEquals(['word1', 'word2', 'word'], $handler->value);
|
||||
$this->assertEquals('or', $handler->operator);
|
||||
$handler = HandlerBase::breakString('word1+word2+word');
|
||||
$this->assertEqualValue(['word1', 'word2', 'word'], $handler);
|
||||
$this->assertEquals(['word1', 'word2', 'word'], $handler->value);
|
||||
$this->assertEquals('or', $handler->operator);
|
||||
$handler = HandlerBase::breakString('word1 word2 word');
|
||||
$this->assertEqualValue(['word1', 'word2', 'word'], $handler);
|
||||
$this->assertEquals(['word1', 'word2', 'word'], $handler->value);
|
||||
$this->assertEquals('or', $handler->operator);
|
||||
$handler = HandlerBase::breakString('word-1+word-2+word');
|
||||
$this->assertEqualValue(['word-1', 'word-2', 'word'], $handler);
|
||||
$this->assertEquals(['word-1', 'word-2', 'word'], $handler->value);
|
||||
$this->assertEquals('or', $handler->operator);
|
||||
$handler = HandlerBase::breakString('wõrd1+wõrd2+wõrd');
|
||||
$this->assertEqualValue(['wõrd1', 'wõrd2', 'wõrd'], $handler);
|
||||
$this->assertEquals(['wõrd1', 'wõrd2', 'wõrd'], $handler->value);
|
||||
$this->assertEquals('or', $handler->operator);
|
||||
|
||||
// Test ands.
|
||||
$handler = HandlerBase::breakString('word1,word2,word');
|
||||
$this->assertEqualValue(['word1', 'word2', 'word'], $handler);
|
||||
$this->assertEquals(['word1', 'word2', 'word'], $handler->value);
|
||||
$this->assertEquals('and', $handler->operator);
|
||||
$handler = HandlerBase::breakString('word1 word2,word');
|
||||
$this->assertEqualValue(['word1 word2', 'word'], $handler);
|
||||
$this->assertEquals(['word1 word2', 'word'], $handler->value);
|
||||
$this->assertEquals('and', $handler->operator);
|
||||
$handler = HandlerBase::breakString('word1,word2 word');
|
||||
$this->assertEqualValue(['word1', 'word2 word'], $handler);
|
||||
$this->assertEquals(['word1', 'word2 word'], $handler->value);
|
||||
$this->assertEquals('and', $handler->operator);
|
||||
$handler = HandlerBase::breakString('word-1,word-2,word');
|
||||
$this->assertEqualValue(['word-1', 'word-2', 'word'], $handler);
|
||||
$this->assertEquals(['word-1', 'word-2', 'word'], $handler->value);
|
||||
$this->assertEquals('and', $handler->operator);
|
||||
$handler = HandlerBase::breakString('wõrd1,wõrd2,wõrd');
|
||||
$this->assertEqualValue(['wõrd1', 'wõrd2', 'wõrd'], $handler);
|
||||
$this->assertEquals(['wõrd1', 'wõrd2', 'wõrd'], $handler->value);
|
||||
$this->assertEquals('and', $handler->operator);
|
||||
|
||||
// Test a single word
|
||||
$handler = HandlerBase::breakString('word');
|
||||
$this->assertEqualValue(['word'], $handler);
|
||||
$this->assertEquals(['word'], $handler->value);
|
||||
$this->assertEquals('and', $handler->operator);
|
||||
|
||||
$s1 = $this->randomMachineName();
|
||||
|
@ -124,45 +124,45 @@ class HandlerTest extends ViewTestBase {
|
|||
|
||||
// Test "or"s.
|
||||
$handlerBase = HandlerBase::breakString("$s1 $n2+$n3");
|
||||
$this->assertEqualValue([$s1, $n2, $n3], $handlerBase);
|
||||
$this->assertEquals([$s1, $n2, $n3], $handlerBase->value);
|
||||
$this->assertEquals('or', $handlerBase->operator);
|
||||
|
||||
$handlerBase = HandlerBase::breakString("$s1+$n2+$n3");
|
||||
$this->assertEqualValue([$s1, $n2, $n3], $handlerBase);
|
||||
$this->assertEquals([$s1, $n2, $n3], $handlerBase->value);
|
||||
$this->assertEquals('or', $handlerBase->operator);
|
||||
|
||||
$handlerBase = HandlerBase::breakString("$s1 $n2 $n3");
|
||||
$this->assertEqualValue([$s1, $n2, $n3], $handlerBase);
|
||||
$this->assertEquals([$s1, $n2, $n3], $handlerBase->value);
|
||||
$this->assertEquals('or', $handlerBase->operator);
|
||||
|
||||
$handlerBase = HandlerBase::breakString("$s1 $n2++$n3");
|
||||
$this->assertEqualValue([$s1, $n2, $n3], $handlerBase);
|
||||
$this->assertEquals([$s1, $n2, $n3], $handlerBase->value);
|
||||
$this->assertEquals('or', $handlerBase->operator);
|
||||
|
||||
// Test "and"s.
|
||||
$handlerBase = HandlerBase::breakString("$s1,$n2,$n3");
|
||||
$this->assertEqualValue([$s1, $n2, $n3], $handlerBase);
|
||||
$this->assertEquals([$s1, $n2, $n3], $handlerBase->value);
|
||||
$this->assertEquals('and', $handlerBase->operator);
|
||||
|
||||
$handlerBase = HandlerBase::breakString("$s1,,$n2,$n3");
|
||||
$this->assertEqualValue([$s1, $n2, $n3], $handlerBase);
|
||||
$this->assertEquals([$s1, $n2, $n3], $handlerBase->value);
|
||||
$this->assertEquals('and', $handlerBase->operator);
|
||||
|
||||
// Enforce int values.
|
||||
$handlerBase = HandlerBase::breakString("$n1,$n2,$n3", TRUE);
|
||||
$this->assertEqualValue([$n1, $n2, $n3], $handlerBase);
|
||||
$this->assertEquals([$n1, $n2, $n3], $handlerBase->value);
|
||||
$this->assertEquals('and', $handlerBase->operator);
|
||||
|
||||
$handlerBase = HandlerBase::breakString("$n1+$n2+$n3", TRUE);
|
||||
$this->assertEqualValue([$n1, $n2, $n3], $handlerBase);
|
||||
$this->assertEquals([$n1, $n2, $n3], $handlerBase->value);
|
||||
$this->assertEquals('or', $handlerBase->operator);
|
||||
|
||||
$handlerBase = HandlerBase::breakString("$s1,$n2,$n3", TRUE);
|
||||
$this->assertEqualValue([(int) $s1, $n2, $n3], $handlerBase);
|
||||
$this->assertEquals([(int) $s1, $n2, $n3], $handlerBase->value);
|
||||
$this->assertEquals('and', $handlerBase->operator);
|
||||
|
||||
$handlerBase = HandlerBase::breakString("$s1+$n2+$n3", TRUE);
|
||||
$this->assertEqualValue([(int) $s1, $n2, $n3], $handlerBase);
|
||||
$this->assertEquals([(int) $s1, $n2, $n3], $handlerBase->value);
|
||||
$this->assertEquals('or', $handlerBase->operator);
|
||||
|
||||
// Generate three random decimals which can be used below;
|
||||
|
@ -172,28 +172,28 @@ class HandlerTest extends ViewTestBase {
|
|||
|
||||
// Test "or"s.
|
||||
$handlerBase = HandlerBase::breakString("$s1 $d1+$d2");
|
||||
$this->assertEqualValue([$s1, $d1, $d2], $handlerBase);
|
||||
$this->assertEquals([$s1, $d1, $d2], $handlerBase->value);
|
||||
$this->assertEquals('or', $handlerBase->operator);
|
||||
|
||||
$handlerBase = HandlerBase::breakString("$s1+$d1+$d3");
|
||||
$this->assertEqualValue([$s1, $d1, $d3], $handlerBase);
|
||||
$this->assertEquals([$s1, $d1, $d3], $handlerBase->value);
|
||||
$this->assertEquals('or', $handlerBase->operator);
|
||||
|
||||
$handlerBase = HandlerBase::breakString("$s1 $d2 $d3");
|
||||
$this->assertEqualValue([$s1, $d2, $d3], $handlerBase);
|
||||
$this->assertEquals([$s1, $d2, $d3], $handlerBase->value);
|
||||
$this->assertEquals('or', $handlerBase->operator);
|
||||
|
||||
$handlerBase = HandlerBase::breakString("$s1 $d2++$d3");
|
||||
$this->assertEqualValue([$s1, $d2, $d3], $handlerBase);
|
||||
$this->assertEquals([$s1, $d2, $d3], $handlerBase->value);
|
||||
$this->assertEquals('or', $handlerBase->operator);
|
||||
|
||||
// Test "and"s.
|
||||
$handlerBase = HandlerBase::breakString("$s1,$d2,$d3");
|
||||
$this->assertEqualValue([$s1, $d2, $d3], $handlerBase);
|
||||
$this->assertEquals([$s1, $d2, $d3], $handlerBase->value);
|
||||
$this->assertEquals('and', $handlerBase->operator);
|
||||
|
||||
$handlerBase = HandlerBase::breakString("$s1,,$d2,$d3");
|
||||
$this->assertEqualValue([$s1, $d2, $d3], $handlerBase);
|
||||
$this->assertEquals([$s1, $d2, $d3], $handlerBase->value);
|
||||
$this->assertEquals('and', $handlerBase->operator);
|
||||
}
|
||||
|
||||
|
@ -223,30 +223,6 @@ class HandlerTest extends ViewTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if a value is the same as the value on a certain handler.
|
||||
*
|
||||
* @param $expected
|
||||
* The expected value to check.
|
||||
* @param \Drupal\views\Plugin\views\ViewsHandlerInterface $handler
|
||||
* The handler that has the $handler->value property to compare with first.
|
||||
* @param string $message
|
||||
* The message to display along with the assertion.
|
||||
* @param string $group
|
||||
* The type of assertion - examples are "Browser", "PHP".
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the assertion succeeded.
|
||||
*/
|
||||
protected function assertEqualValue($expected, $handler, $message = '', $group = 'Other') {
|
||||
if (empty($message)) {
|
||||
$message = t('Comparing @first and @second', ['@first' => implode(',', $expected), '@second' => implode(',', $handler->value)]);
|
||||
}
|
||||
|
||||
$this->assertEquals($expected, $handler->value, $message);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the relationship ui for field/filter/argument/relationship.
|
||||
*/
|
||||
|
|
|
@ -36,8 +36,8 @@ class ViewsFormMultipleTest extends ViewTestBase {
|
|||
protected function viewsData() {
|
||||
$data = parent::viewsData();
|
||||
$data['views_test_data']['field_form_button_test']['field'] = [
|
||||
'title' => t('Button test'),
|
||||
'help' => t('Adds a test form button.'),
|
||||
'title' => 'Button test',
|
||||
'help' => 'Adds a test form button.',
|
||||
'id' => 'field_form_button_test',
|
||||
];
|
||||
return $data;
|
||||
|
|
|
@ -179,7 +179,7 @@ class ExposedFilterAJAXTest extends WebDriverTestBase {
|
|||
$ajax_views_before = $drupal_settings['views']['ajaxViews'];
|
||||
|
||||
// Search for "Page One".
|
||||
$this->submitForm(['title' => 'Page One'], t('Filter'));
|
||||
$this->submitForm(['title' => 'Page One'], 'Filter');
|
||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
||||
|
||||
// Verify that only the "Page One" Node is present.
|
||||
|
|
|
@ -70,7 +70,7 @@ class FieldBooleanTest extends ViewsKernelTestBase {
|
|||
$this->assertEquals('✔', $view->field['age']->advancedRender($view->result[1]));
|
||||
|
||||
// Set a custom output format.
|
||||
$view->field['age']->formats['test'] = [t('Test-True'), t('Test-False')];
|
||||
$view->field['age']->formats['test'] = ['Test-True', 'Test-False'];
|
||||
$view->field['age']->options['type'] = 'test';
|
||||
$this->assertEquals('Test-False', $view->field['age']->advancedRender($view->result[0]));
|
||||
$this->assertEquals('Test-True', $view->field['age']->advancedRender($view->result[1]));
|
||||
|
|
|
@ -122,10 +122,10 @@ class FieldDateTest extends ViewsKernelTestBase {
|
|||
$time_since = $date_formatter->formatTimeDiffSince($time);
|
||||
$intervals = [
|
||||
'raw time ago' => $time_since,
|
||||
'time ago' => t('%time ago', ['%time' => $time_since]),
|
||||
'time ago' => "$time_since ago",
|
||||
'raw time span' => $time_since,
|
||||
'inverse time span' => "-$time_since",
|
||||
'time span' => t('%time ago', ['%time' => $time_since]),
|
||||
'time span' => "$time_since ago",
|
||||
];
|
||||
$this->assertRenderedDatesEqual($view, $intervals);
|
||||
|
||||
|
@ -134,9 +134,7 @@ class FieldDateTest extends ViewsKernelTestBase {
|
|||
$formatted = $date_formatter->formatTimeDiffUntil($time);
|
||||
$intervals = [
|
||||
'raw time span' => "-$formatted",
|
||||
'time span' => t('%time hence', [
|
||||
'%time' => $formatted,
|
||||
]),
|
||||
'time span' => "$formatted hence",
|
||||
];
|
||||
$this->assertRenderedFutureDatesEqual($view, $intervals);
|
||||
}
|
||||
|
@ -154,20 +152,15 @@ class FieldDateTest extends ViewsKernelTestBase {
|
|||
protected function assertRenderedDatesEqual($view, $map, $timezone = NULL) {
|
||||
foreach ($map as $date_format => $expected_result) {
|
||||
$view->field['created']->options['date_format'] = $date_format;
|
||||
$t_args = [
|
||||
'%value' => $expected_result,
|
||||
'%format' => $date_format,
|
||||
];
|
||||
if (isset($timezone)) {
|
||||
$t_args['%timezone'] = $timezone;
|
||||
$message = t('Value %value in %format format for timezone %timezone matches.', $t_args);
|
||||
$message = "$date_format format for timezone $timezone matches.";
|
||||
$view->field['created']->options['timezone'] = $timezone;
|
||||
}
|
||||
else {
|
||||
$message = t('Value %value in %format format matches.', $t_args);
|
||||
$message = "$date_format format matches.";
|
||||
}
|
||||
$actual_result = $view->field['created']->advancedRender($view->result[0]);
|
||||
$this->assertEquals($expected_result, $actual_result, $message);
|
||||
$this->assertEquals($expected_result, strip_tags($actual_result), $message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,13 +176,7 @@ class FieldDateTest extends ViewsKernelTestBase {
|
|||
foreach ($map as $format => $result) {
|
||||
$view->field['destroyed']->options['date_format'] = $format;
|
||||
$view_result = $view->field['destroyed']->advancedRender($view->result[0]);
|
||||
$t_args = [
|
||||
'%value' => $result,
|
||||
'%format' => $format,
|
||||
'%actual' => $view_result,
|
||||
];
|
||||
$message = t('Value %value in %format matches %actual', $t_args);
|
||||
$this->assertEquals($result, $view_result, $message);
|
||||
$this->assertEquals($result, strip_tags($view_result), "$format format matches.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ class ModuleTest extends ViewsKernelTestBase {
|
|||
$expected_opt_groups = [];
|
||||
foreach ($all_views as $view) {
|
||||
foreach ($view->get('display') as $display) {
|
||||
$expected_opt_groups[$view->id()][$view->id() . ':' . $display['id']] = (string) t('@view : @display', ['@view' => $view->id(), '@display' => $display['id']]);
|
||||
$expected_opt_groups[$view->id()][$view->id() . ':' . $display['id']] = $view->id() . ' : ' . $display['id'];
|
||||
}
|
||||
}
|
||||
$this->assertEquals($expected_opt_groups, Views::getViewsAsOptions(FALSE, 'all', NULL, TRUE), 'Expected option array for an option group returned.');
|
||||
|
@ -325,8 +325,7 @@ class ModuleTest extends ViewsKernelTestBase {
|
|||
$expected_options = [];
|
||||
foreach ($views as $view) {
|
||||
foreach ($view->get('display') as $display) {
|
||||
$expected_options[$view->id() . ':' . $display['id']] = (string) t('View: @view - Display: @display',
|
||||
['@view' => $view->id(), '@display' => $display['id']]);
|
||||
$expected_options[$view->id() . ':' . $display['id']] = "View: {$view->id()} - Display: {$display['id']}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class BlockDependenciesTest extends ViewsKernelTestBase {
|
|||
* example:
|
||||
* @code
|
||||
* $this->createBlock('system_powered_by_block', array(
|
||||
* 'label' => t('Hello, world!'),
|
||||
* 'label' => 'Hello, world!',
|
||||
* ));
|
||||
* @endcode
|
||||
* The following defaults are provided:
|
||||
|
|
|
@ -49,7 +49,7 @@ class ExposedFormRenderTest extends ViewsKernelTestBase {
|
|||
$expected_action = $view->display_handler->getUrlInfo()->toString();
|
||||
$this->assertFieldByXPath('//form/@action', $expected_action, 'The expected value for the action attribute was found.');
|
||||
// Make sure the description is shown.
|
||||
$result = $this->xpath('//form//div[contains(@id, :id) and normalize-space(text())=:description]', [':id' => 'edit-type--2--description', ':description' => t('Exposed description')]);
|
||||
$result = $this->xpath('//form//div[contains(@id, "edit-type--2--description") and normalize-space(text())="Exposed description"]');
|
||||
$this->assertCount(1, $result, 'Filter description was found.');
|
||||
}
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ class HandlerTest extends UITestBase {
|
|||
protected function viewsData() {
|
||||
$data = parent::viewsData();
|
||||
$data['views_test_data']['uid'] = [
|
||||
'title' => t('UID'),
|
||||
'help' => t('The test data UID'),
|
||||
'title' => 'UID',
|
||||
'help' => 'The test data UID',
|
||||
'relationship' => [
|
||||
'id' => 'standard',
|
||||
'base' => 'users_field_data',
|
||||
|
@ -84,7 +84,7 @@ class HandlerTest extends UITestBase {
|
|||
|
||||
// Create a dummy field with no help text.
|
||||
$data['views_test_data']['no_help'] = $data['views_test_data']['name'];
|
||||
$data['views_test_data']['no_help']['field']['title'] = t('No help');
|
||||
$data['views_test_data']['no_help']['field']['title'] = 'No help';
|
||||
$data['views_test_data']['no_help']['field']['real field'] = 'name';
|
||||
unset($data['views_test_data']['no_help']['help']);
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ class MultiFormTest extends WebDriverTestBase {
|
|||
$form_xpath = '//form[starts-with(@id, "node-page-form")]';
|
||||
$field_xpath = '//div[contains(@class, "field--name-field-ajax-test")]';
|
||||
$button_name = $field_name . '_add_more';
|
||||
$button_value = t('Add another item');
|
||||
$button_xpath_suffix = '//input[@name="' . $button_name . '"]';
|
||||
$field_items_xpath_suffix = '//input[@type="text"]';
|
||||
|
||||
|
@ -95,7 +94,7 @@ class MultiFormTest extends WebDriverTestBase {
|
|||
for ($i = 0; $i < 2; $i++) {
|
||||
$forms = $page->find('xpath', $form_xpath);
|
||||
foreach ($forms as $offset => $form) {
|
||||
$button = $form->findButton($button_value);
|
||||
$button = $form->findButton('Add another item');
|
||||
$this->assertNotNull($button, 'Add Another Item button exists');
|
||||
$button->press();
|
||||
|
||||
|
|
|
@ -510,8 +510,8 @@ class ConfigEntityQueryTest extends KernelTestBase {
|
|||
*/
|
||||
public function testTableSort() {
|
||||
$header = [
|
||||
['data' => t('ID'), 'specifier' => 'id'],
|
||||
['data' => t('Number'), 'specifier' => 'number'],
|
||||
['data' => 'ID', 'specifier' => 'id'],
|
||||
['data' => 'Number', 'specifier' => 'number'],
|
||||
];
|
||||
|
||||
// Sort key: id
|
||||
|
|
|
@ -37,7 +37,7 @@ class MessengerTest extends KernelTestBase {
|
|||
|
||||
// Set two messages.
|
||||
$this->messenger->addStatus('First message (removed).');
|
||||
$this->messenger->addStatus(t('Second message with <em>markup!</em> (not removed).'));
|
||||
$this->messenger->addStatus('Second message with <em>markup!</em> (not removed).');
|
||||
$messages = $this->messenger->deleteByType(MessengerInterface::TYPE_STATUS);
|
||||
// Remove the first.
|
||||
unset($messages[0]);
|
||||
|
|
|
@ -52,7 +52,7 @@ class ContextPluginTest extends KernelTestBase {
|
|||
}
|
||||
|
||||
// Test the getContextDefinitions() method.
|
||||
$user_context_definition = EntityContextDefinition::fromEntityTypeId('user')->setLabel(t('User'));
|
||||
$user_context_definition = EntityContextDefinition::fromEntityTypeId('user')->setLabel('User');
|
||||
$this->assertEquals($plugin->getContextDefinitions()['user']->getLabel(), $user_context_definition->getLabel());
|
||||
|
||||
// Test the getContextDefinition() method for a valid context.
|
||||
|
|
Loading…
Reference in New Issue