You are here

protected function NodeIntegrationTest::assertNids in Drupal 8

Same name and namespace in other branches
  1. 9 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);
}