function SelectionTest::assertResults

Same name in other branches
  1. 9 core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php \Drupal\Tests\field\Kernel\EntityReference\Views\SelectionTest::assertResults()
  2. 8.9.x core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php \Drupal\Tests\field\Kernel\EntityReference\Views\SelectionTest::assertResults()
  3. 11.x core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php \Drupal\Tests\field\Kernel\EntityReference\Views\SelectionTest::assertResults()

Confirm the expected results are returned.

@internal

Parameters

array $result: Query results keyed by node type and nid.

1 call to SelectionTest::assertResults()
SelectionTest::testSelectionHandler in core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php
Tests the selection handler.

File

core/modules/field/tests/src/Kernel/EntityReference/Views/SelectionTest.php, line 166

Class

SelectionTest
Tests entity reference selection handler.

Namespace

Drupal\Tests\field\Kernel\EntityReference\Views

Code

protected function assertResults(array $result) : void {
    foreach ($result as $node_type => $values) {
        foreach ($values as $nid => $label) {
            $this->assertSame($node_type, $this->nodes[$nid]
                ->bundle());
            $this->assertSame(trim(strip_tags((string) $label)), Html::escape($this->nodes[$nid]
                ->label()));
        }
    }
}

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