diff --git a/tests/src/Functional/BulkFormTest.php b/tests/src/Functional/BulkFormTest.php index 4acc23443c556599d3066053052da9928b08ed4a..74c8926f28c1fd41b5765e69eade0ed7e4919ea1 100644 --- a/tests/src/Functional/BulkFormTest.php +++ b/tests/src/Functional/BulkFormTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\override_node_options\Functional; +use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Tests\BrowserTestBase; /** @@ -11,6 +12,8 @@ use Drupal\Tests\BrowserTestBase; */ class BulkFormTest extends BrowserTestBase { + use StringTranslationTrait; + /** * {@inheritdoc} */ @@ -55,7 +58,7 @@ class BulkFormTest extends BrowserTestBase { 'node_bulk_form[0]' => TRUE, ]; - $this->submitForm($edit, t('Apply to selected items')); + $this->submitForm($edit, $this->t('Apply to selected items')); $this->assertSession()->pageTextContains('Unpublish content was applied to 1 item.'); $this->assertSession()->pageTextNotContains('No access to execute Unpublish content'); diff --git a/tests/src/Functional/NodeFormTest.php b/tests/src/Functional/NodeFormTest.php index 0b266975365a143c257efc03c713a547017bf474..2d889b0219df8dc0444917deed0ea95732ab8de1 100644 --- a/tests/src/Functional/NodeFormTest.php +++ b/tests/src/Functional/NodeFormTest.php @@ -2,10 +2,11 @@ namespace Drupal\Tests\override_node_options\Functional; +use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\Tests\BrowserTestBase; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; use Drupal\node\NodeInterface; -use Drupal\Tests\BrowserTestBase; /** * Unit tests for the override_node_options module. @@ -14,6 +15,8 @@ use Drupal\Tests\BrowserTestBase; */ class NodeFormTest extends BrowserTestBase { + use StringTranslationTrait; + /** * A standard authenticated user. * @@ -46,7 +49,7 @@ class NodeFormTest extends BrowserTestBase { $types = NodeType::loadMultiple(); if (empty($types['article'])) { - $this->drupalCreateContentType(['type' => 'page', 'name' => t('Page')]); + $this->drupalCreateContentType(['type' => 'page', 'name' => $this->t('Page')]); } $this->normalUser = $this->drupalCreateUser([ @@ -82,7 +85,7 @@ class NodeFormTest extends BrowserTestBase { self::assertEquals( $node->get($field)->value, $value, - t('Node :field was updated to :value, expected :expected.', + $this->t('Node :field was updated to :value, expected :expected.', [ ':field' => $field, ':value' => $node->get($field)->value, @@ -149,7 +152,7 @@ class NodeFormTest extends BrowserTestBase { 'status[value]' => TRUE, 'sticky[value]' => TRUE, ], - t('Save') + $this->t('Save') ); $this->assertNodeFieldsUpdated($this->node, $fields); @@ -190,7 +193,7 @@ class NodeFormTest extends BrowserTestBase { $this->submitForm([ 'revision' => TRUE, 'revision_log[0][value]' => '', - ], t('Save')); + ], $this->t('Save')); $this->assertNodeFieldsUpdated($this->node, [], $this->node->getRevisionId()); } @@ -232,15 +235,15 @@ class NodeFormTest extends BrowserTestBase { $this->drupalGet('node/' . $this->node->id() . '/edit'); - $this->submitForm(['uid[0][target_id]' => 'invalid-user'], t('Save')); + $this->submitForm(['uid[0][target_id]' => 'invalid-user'], $this->t('Save')); $this->assertSession()->pageTextContains('There are no entities matching "invalid-user".'); - $this->submitForm(['created[0][value][date]' => 'invalid-date'], t('Save')); + $this->submitForm(['created[0][value][date]' => 'invalid-date'], $this->t('Save')); $this->assertSession()->pageTextContains('The Authored on date is invalid.'); - $this->submitForm($fields, t('Save')); + $this->submitForm($fields, $this->t('Save')); $this->assertNodeFieldsUpdated($this->node, [ 'created' => $time,