protected function WebTestBase::drupalLogout in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::drupalLogout()
Logs a user out of the internal browser and confirms.
Confirms logout by checking the login page.
116 calls to WebTestBase::drupalLogout()
- AccessDeniedTest::testAccessDenied in core/
modules/ system/ src/ Tests/ System/ AccessDeniedTest.php - AccessRoleTest::testAccessRole in core/
modules/ user/ src/ Tests/ Views/ AccessRoleTest.php - Tests role access plugin.
- AggregatorRenderingTest::testFeedPage in core/
modules/ aggregator/ src/ Tests/ AggregatorRenderingTest.php - Creates a feed and checks that feed's page.
- BlockCacheTest::testCachePermissions in core/
modules/ block/ src/ Tests/ BlockCacheTest.php - Test a cacheable block without any additional cache context.
- BlockCacheTest::testCachePerRole in core/
modules/ block/ src/ Tests/ BlockCacheTest.php - Test "user.roles" cache context.
File
- core/
modules/ simpletest/ src/ WebTestBase.php, line 644 - Contains \Drupal\simpletest\WebTestBase.
Class
- WebTestBase
- Test case for typical Drupal tests.
Namespace
Drupal\simpletestCode
protected function drupalLogout() {
// Make a request to the logout page, and redirect to the user page, the
// idea being if you were properly logged out you should be seeing a login
// screen.
$this
->drupalGet('user/logout', array(
'query' => array(
'destination' => 'user/login',
),
));
$this
->assertResponse(200, 'User was logged out.');
$pass = $this
->assertField('name', 'Username field found.', 'Logout');
$pass = $pass && $this
->assertField('pass', 'Password field found.', 'Logout');
if ($pass) {
// @see WebTestBase::drupalUserIsLoggedIn()
unset($this->loggedInUser->session_id);
$this->loggedInUser = FALSE;
$this->container
->get('current_user')
->setAccount(new AnonymousUserSession());
}
}