function DevelSwitchUserTest::assertSwitchUserListNoContainsUser

Same name in other branches
  1. 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 250

Class

DevelSwitchUserTest
Tests switch user.

Namespace

Drupal\Tests\devel\Functional

Code

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