function NodeIntegrationTest::assertNids

Same name in other branches
  1. 9 core/modules/node/tests/src/Functional/Views/NodeIntegrationTest.php \Drupal\Tests\node\Functional\Views\NodeIntegrationTest::assertNids()
  2. 8.9.x core/modules/node/tests/src/Functional/Views/NodeIntegrationTest.php \Drupal\Tests\node\Functional\Views\NodeIntegrationTest::assertNids()
  3. 11.x core/modules/node/tests/src/Functional/Views/NodeIntegrationTest.php \Drupal\Tests\node\Functional\Views\NodeIntegrationTest::assertNids()

Ensures that a list of nodes appear on the page.

@internal

Parameters

array $expected_nids: An array of node IDs.

1 call to NodeIntegrationTest::assertNids()
NodeIntegrationTest::testNodeViewTypeArgument in core/modules/node/tests/src/Functional/Views/NodeIntegrationTest.php
Tests basic node view with a node type argument.

File

core/modules/node/tests/src/Functional/Views/NodeIntegrationTest.php, line 67

Class

NodeIntegrationTest
Tests the node integration into views.

Namespace

Drupal\Tests\node\Functional\Views

Code

protected function assertNids(array $expected_nids = []) : void {
    $result = $this->xpath('//span[@class="field-content"]');
    $nids = [];
    foreach ($result as $element) {
        $nids[] = (int) $element->getText();
    }
    $this->assertEquals($expected_nids, $nids);
}

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