You are here

protected function NodeTranslationUITest::doTestTranslations in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/node/tests/src/Functional/NodeTranslationUITest.php \Drupal\Tests\node\Functional\NodeTranslationUITest::doTestTranslations()

Tests that the given path displays the correct translation values.

Parameters

string $path: The path to be tested.

array $values: The translation values to be found.

1 call to NodeTranslationUITest::doTestTranslations()
NodeTranslationUITest::testTranslationRendering in core/modules/node/tests/src/Functional/NodeTranslationUITest.php
Tests that translations are rendered properly.

File

core/modules/node/tests/src/Functional/NodeTranslationUITest.php, line 385

Class

NodeTranslationUITest
Tests the Node Translation UI.

Namespace

Drupal\Tests\node\Functional

Code

protected function doTestTranslations($path, array $values) {
  $languages = $this->container
    ->get('language_manager')
    ->getLanguages();
  foreach ($this->langcodes as $langcode) {
    $this
      ->drupalGet($path, [
      'language' => $languages[$langcode],
    ]);
    $this
      ->assertText($values[$langcode]['title'][0]['value'], new FormattableMarkup('The %langcode node translation is correctly displayed.', [
      '%langcode' => $langcode,
    ]));
  }
}