protected function UiHelperTrait::drupalLogout in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::drupalLogout()
- 10 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::drupalLogout()
Logs a user out of the Mink controlled browser and confirms.
Confirms logout by checking the login page.
155 calls to UiHelperTrait::drupalLogout()
- AccessDeniedTest::testAccessDenied in core/
modules/ system/ tests/ src/ Functional/ System/ AccessDeniedTest.php - AccessRoleTest::testAccessRole in core/
modules/ user/ tests/ src/ Functional/ Views/ AccessRoleTest.php - Tests role access plugin.
- AggregatorRenderingTest::testFeedPage in core/
modules/ aggregator/ tests/ src/ Functional/ AggregatorRenderingTest.php - Creates a feed and checks that feed's page.
- BigPipeTest::testNoJsDetection in core/
modules/ big_pipe/ tests/ src/ Functional/ BigPipeTest.php - Tests BigPipe's no-JS detection.
- BlockCacheTest::testCachePermissions in core/
modules/ block/ tests/ src/ Functional/ BlockCacheTest.php - Test a cacheable block without any additional cache context.
File
- core/
tests/ Drupal/ Tests/ UiHelperTrait.php, line 265
Class
- UiHelperTrait
- Provides UI helper methods.
Namespace
Drupal\TestsCode
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.
$assert_session = $this
->assertSession();
$destination = Url::fromRoute('user.page')
->toString();
$this
->drupalGet(Url::fromRoute('user.logout', [], [
'query' => [
'destination' => $destination,
],
]));
$assert_session
->fieldExists('name');
$assert_session
->fieldExists('pass');
// @see BrowserTestBase::drupalUserIsLoggedIn()
unset($this->loggedInUser->sessionId);
$this->loggedInUser = FALSE;
\Drupal::currentUser()
->setAccount(new AnonymousUserSession());
}