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. 10 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.

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 63

Class

NodeIntegrationTest
Tests the node integration into views.

Namespace

Drupal\Tests\node\Functional\Views

Code

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

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