function UiHelperTrait::drupalLogout
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::drupalLogout()
- 10 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::drupalLogout()
- 9 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::drupalLogout()
- 8.9.x 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.
75 calls to UiHelperTrait::drupalLogout()
- AlertsJsonFeedTest::testAnnounceFeedUpdatedAndRemoved in core/
modules/ announcements_feed/ tests/ src/ FunctionalJavascript/ AlertsJsonFeedTest.php - Check the status of the announcements when the feed is updated and removed.
- AnnounceBlockTest::testAnnounceWithoutPermission in core/
modules/ announcements_feed/ tests/ src/ FunctionalJavascript/ AnnounceBlockTest.php - Testing announce feed block visibility.
- BlockContentListTest::testListing in core/
modules/ block_content/ tests/ src/ Functional/ BlockContentListTest.php - Tests the content block listing page with different permissions.
- BlockContentListViewsTest::testListing in core/
modules/ block_content/ tests/ src/ Functional/ BlockContentListViewsTest.php - Tests the content block listing page.
- ConfigExportUITest::testExport in core/
modules/ config/ tests/ src/ Functional/ ConfigExportUITest.php - Tests export of configuration.
File
-
core/
tests/ Drupal/ Tests/ UiHelperTrait.php, line 197
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.confirm', options: [
'query' => [
'destination' => $destination,
],
]));
// Target the submit button using the name rather than the value to work
// regardless of the user interface language.
$this->submitForm([], 'op', 'user-logout-confirm');
$assert_session->fieldExists('name');
$assert_session->fieldExists('pass');
$this->drupalResetSession();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.