You are here

public function DevelSwitchUserTest::assertSwitchUserListCount in Devel 8.3

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