Skip to content
Snippets Groups Projects
Unverified Commit a83a7a78 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3231781 by longwave, mondrake, Feuerwagen, larowlan, TR, nlisgo,...

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
parent 6d39cdee
No related branches found
No related tags found
No related merge requests found
Showing
with 38 additions and 55 deletions
......@@ -56,7 +56,7 @@ protected function createEntity() {
// 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 @@ public function testEntityCreation() {
// 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 @@ protected function setUp(): void {
*/
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 @@ public function testBlockInterface() {
],
'admin_label' => [
'#type' => 'item',
'#title' => t('Block description'),
'#title' => 'Block description',
'#plain_text' => $definition['admin_label'],
],
'label' => [
......@@ -78,7 +78,7 @@ public function testBlockInterface() {
'context_mapping' => [],
'display_message' => [
'#type' => 'textfield',
'#title' => t('Display message'),
'#title' => 'Display message',
'#default_value' => 'My custom display message.',
],
];
......
......@@ -370,11 +370,8 @@ public function testTwoPagers() {
// 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 @@ protected function setUp(): void {
parent::setUp();
$node_type = NodeType::create([
'type' => 'article',
'name' => t('Article'),
'name' => 'Article',
]);
$node_type->save();
$this->nodeAuthor = $this->drupalCreateUser([
......
......@@ -51,7 +51,7 @@ public function testCommentCount() {
$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 @@ public function testList() {
// 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 @@ public function testList() {
// 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 @@ public function testSendPersonalContactMessage() {
$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 @@ public function testSendPersonalContactMessage() {
$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 @@ public function testWorkflows() {
$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 @@ private function verifyBreadcrumbs() {
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 @@ public function testNestedEntityFormEntityLevelValidation() {
// 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 @@ public function manageFieldsPage($type = '') {
$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 @@ public function testHiddenFields() {
'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 @@ public function fieldUIAddNewField($bundle_path, $field_name, $label = NULL, $fi
$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 @@ public function testComponentDependencies() {
$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 @@ public function testPrivateFile() {
// 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 @@ public function testPrivateFile() {
$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 @@ public function testManagedFile() {
$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 @@ public function testImageSource() {
$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 @@ public function testImageSource() {
$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 @@ public function createForumTopic($forum, $container = FALSE) {
$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 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) {
$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 @@ private function verifyForumView($forum, $parent = NULL) {
$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 @@ public function testForumUninstallWithField() {
// Create a taxonomy term.
$term = Term::create([
'name' => t('A term'),
'name' => 'A term',
'langcode' => \Drupal::languageManager()->getDefaultLanguage()->getId(),
'description' => '',
'parent' => [0],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment