function DevelSwitchUserTest::assertSwitchUserListCount

Same name in other branches
  1. 5.x tests/src/Functional/DevelSwitchUserTest.php \Drupal\Tests\devel\Functional\DevelSwitchUserTest::assertSwitchUserListCount()

Helper function for verify the number of items shown in the user list.

Parameters

int $number: The expected numer of items.

2 calls to DevelSwitchUserTest::assertSwitchUserListCount()
DevelSwitchUserTest::testSwitchUserBlockConfiguration in tests/src/Functional/DevelSwitchUserTest.php
Tests the switch user block configuration.
DevelSwitchUserTest::testSwitchUserListItems in tests/src/Functional/DevelSwitchUserTest.php
Test the user list items.

File

tests/src/Functional/DevelSwitchUserTest.php, line 214

Class

DevelSwitchUserTest
Tests switch user.

Namespace

Drupal\Tests\devel\Functional

Code

public function assertSwitchUserListCount($number) {
    $result = $this->xpath('//div[@id=:block]//ul/li/a', [
        ':block' => 'block-switch-user',
    ]);
    $this->assertTrue(count($result) == $number, 'The number of users shown in switch user is correct.');
}