public function DevelSwitchUserTest::assertSwitchUserListContainsUser in Devel 8
Same name and namespace in other branches
- 8.3 tests/src/Functional/DevelSwitchUserTest.php \Drupal\Tests\devel\Functional\DevelSwitchUserTest::assertSwitchUserListContainsUser()
- 8.2 tests/src/Functional/DevelSwitchUserTest.php \Drupal\Tests\devel\Functional\DevelSwitchUserTest::assertSwitchUserListContainsUser()
- 4.x tests/src/Functional/DevelSwitchUserTest.php \Drupal\Tests\devel\Functional\DevelSwitchUserTest::assertSwitchUserListContainsUser()
Helper function for verify if the user list contains a username.
Parameters
string $username: The username to check.
2 calls to DevelSwitchUserTest::assertSwitchUserListContainsUser()
- 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 226
Class
- DevelSwitchUserTest
- Tests switch user.
Namespace
Drupal\Tests\devel\FunctionalCode
public function assertSwitchUserListContainsUser($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 included in the switch user list.', [
'%user' => $username,
]));
}