function NodeTranslationUITest::doTestTranslations

Same name in other branches
  1. 9 core/modules/node/tests/src/Functional/NodeTranslationUITest.php \Drupal\Tests\node\Functional\NodeTranslationUITest::doTestTranslations()
  2. 8.9.x core/modules/node/tests/src/Functional/NodeTranslationUITest.php \Drupal\Tests\node\Functional\NodeTranslationUITest::doTestTranslations()
  3. 11.x 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 405

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->assertSession()
            ->pageTextContains($values[$langcode]['title'][0]['value']);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.