You are here

protected function FieldRenderedEntityTranslationTest::assertRows in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/Entity/FieldRenderedEntityTranslationTest.php \Drupal\Tests\views\Functional\Entity\FieldRenderedEntityTranslationTest::assertRows()
  2. 10 core/modules/views/tests/src/Functional/Entity/FieldRenderedEntityTranslationTest.php \Drupal\Tests\views\Functional\Entity\FieldRenderedEntityTranslationTest::assertRows()

Ensures that the rendered results are working as expected.

Parameters

array $expected: The expected rows of the result.

1 call to FieldRenderedEntityTranslationTest::assertRows()
FieldRenderedEntityTranslationTest::testTranslationRows in core/modules/views/tests/src/Functional/Entity/FieldRenderedEntityTranslationTest.php
Tests that different translation mechanisms can be used for base fields.

File

core/modules/views/tests/src/Functional/Entity/FieldRenderedEntityTranslationTest.php, line 291

Class

FieldRenderedEntityTranslationTest
Tests the rendering of the 'rendered_entity' field and translations.

Namespace

Drupal\Tests\views\Functional\Entity

Code

protected function assertRows(array $expected = []) {
  $actual = [];
  $rows = $this
    ->cssSelect('div.views-row');
  foreach ($rows as $row) {
    $actual[] = [
      'title' => $row
        ->find('xpath', (new CssSelectorConverter())
        ->toXPath('h2 a .field--name-title'))
        ->getText(),
    ];
  }
  $this
    ->assertEquals($actual, $expected);
}