You are here

public function GNodeWebTestBase::assertNodesOnListingPage in Group 7

Check that only the specified nodes are listed at /node.

Parameters

int[] $expected_nids: A list of expected nids.

string $message: Assertion message.

7 calls to GNodeWebTestBase::assertNodesOnListingPage()
GNodeViewAccessTests::testAnonymousPermissionBuildUp in modules/gnode/tests/gnode.test
Test the anonymous user does not receive access until their role has access even when higher roles do have access.
GNodeViewAccessTests::testAnonymousViewAccess in modules/gnode/tests/gnode.test
Test anonymous user's view access to nodes in a group.
GNodeViewAccessTests::testMemberViewAccess in modules/gnode/tests/gnode.test
Test member user's view access to nodes in a group.
GNodeViewAccessTests::testMemberWithGlobalRoleViewAccess in modules/gnode/tests/gnode.test
Test member user's view access to nodes in a group when the permission is granted via a global level role.
GNodeViewAccessTests::testMemberWithGroupRoleViewAccess in modules/gnode/tests/gnode.test
Test member user's view access to nodes in a group when the permission is granted via a group level role.

... See full list

File

modules/gnode/tests/gnode.test, line 72
Tests for the gnode module.

Class

GNodeWebTestBase
Base class provides a number of helper functions.

Code

public function assertNodesOnListingPage(array $expected_nids = array(), $message = 'Nodes listed on the node listing page are expected.') {
  $this
    ->drupalGet('node');
  $node_divs = $this
    ->xpath("//div[contains(@class, 'node-promoted')]");
  $actual_nids = array();

  /** @var SimpleXMLElement $node_div */
  foreach ($node_divs as $node_div) {
    $id = (string) $node_div
      ->attributes()->id;
    $actual_nids[] = (int) substr($id, 5);
  }
  $this
    ->assertEqual($expected_nids, $actual_nids, $message);
}