You are here

public function DevelSwitchUserTest::assertSwitchUserListCount in Devel 8.2

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/DevelSwitchUserTest.php \Drupal\Tests\devel\Functional\DevelSwitchUserTest::assertSwitchUserListCount()
  2. 8 tests/src/Functional/DevelSwitchUserTest.php \Drupal\Tests\devel\Functional\DevelSwitchUserTest::assertSwitchUserListCount()
  3. 4.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 222

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
    ->assert(count($result) == $number, 'The number of users shown in switch user is correct.');
}