function DevelSwitchUserTest::assertNoSessionByUid
Same name in other branches
- 8.x-1.x tests/src/Functional/DevelSwitchUserTest.php \Drupal\Tests\devel\Functional\DevelSwitchUserTest::assertNoSessionByUid()
- 4.x tests/src/Functional/DevelSwitchUserTest.php \Drupal\Tests\devel\Functional\DevelSwitchUserTest::assertNoSessionByUid()
Asserts that no session exists for a given uid.
Based off masquarade module.
@todo find a cleaner way to do this check.
Parameters
int $uid: The user ID to assert.
1 call to DevelSwitchUserTest::assertNoSessionByUid()
- DevelSwitchUserTest::testSwitchUserFunctionality in tests/
src/ Functional/ DevelSwitchUserTest.php - Tests switch user basic functionality.
File
-
tests/
src/ Functional/ DevelSwitchUserTest.php, line 313
Class
- DevelSwitchUserTest
- Tests switch user.
Namespace
Drupal\Tests\devel\FunctionalCode
protected function assertNoSessionByUid($uid) {
$result = \Drupal::database()->select('sessions')
->fields('sessions', [
'uid',
])
->condition('uid', $uid)
->execute()
->fetchAll();
$this->assertEmpty($result, sprintf('No session for uid %d found.', $uid));
}