You are here

public function DevelSwitchUserTest::assertSwitchUserListNoContainsUser in Devel 8

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/DevelSwitchUserTest.php \Drupal\Tests\devel\Functional\DevelSwitchUserTest::assertSwitchUserListNoContainsUser()
  2. 8.2 tests/src/Functional/DevelSwitchUserTest.php \Drupal\Tests\devel\Functional\DevelSwitchUserTest::assertSwitchUserListNoContainsUser()
  3. 4.x tests/src/Functional/DevelSwitchUserTest.php \Drupal\Tests\devel\Functional\DevelSwitchUserTest::assertSwitchUserListNoContainsUser()

Helper function for verify if the user list not contains a username.

Parameters

string $username: The username to check.

2 calls to DevelSwitchUserTest::assertSwitchUserListNoContainsUser()
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 237

Class

DevelSwitchUserTest
Tests switch user.

Namespace

Drupal\Tests\devel\Functional

Code

public function assertSwitchUserListNoContainsUser($username) {
  $result = $this
    ->xpath('//div[@id=:block]//ul/li/a[normalize-space()=:user]', [
    ':block' => 'block-switch-user',
    ':user' => $username,
  ]);
  $this
    ->assert(count($result) == 0, new FormattableMarkup('User "%user" is not included in the switch user list.', [
    '%user' => $username,
  ]));
}