function FieldEntityTranslationTest::assertRows

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Functional/Entity/FieldEntityTranslationTest.php \Drupal\Tests\views\Functional\Entity\FieldEntityTranslationTest::assertRows()
  2. 10 core/modules/views/tests/src/Functional/Entity/FieldEntityTranslationTest.php \Drupal\Tests\views\Functional\Entity\FieldEntityTranslationTest::assertRows()
  3. 11.x core/modules/views/tests/src/Functional/Entity/FieldEntityTranslationTest.php \Drupal\Tests\views\Functional\Entity\FieldEntityTranslationTest::assertRows()

Ensures that the rendered results are working as expected.

@internal

Parameters

array $expected: The expected rows of the result.

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

File

core/modules/views/tests/src/Functional/Entity/FieldEntityTranslationTest.php, line 174

Class

FieldEntityTranslationTest
Tests the rendering of fields (base fields) and their translations.

Namespace

Drupal\Tests\views\Functional\Entity

Code

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

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