You are here

protected function ChildSiteTestBase::drupalLogout in Bakery Single Sign-On System 8.2

Logs a user out of the Mink controlled browser and confirms.

Confirms logout by checking the login page.

Overrides UiHelperTrait::drupalLogout

2 calls to ChildSiteTestBase::drupalLogout()
ChildLoginTest::testLogout in tests/src/Functional/ChildLoginTest.php
ChildSitePagesTest::testPages in tests/src/Functional/ChildSitePagesTest.php
Test some pages.

File

tests/src/Functional/ChildSiteTestBase.php, line 23

Class

ChildSiteTestBase

Namespace

Drupal\Tests\bakery\Functional

Code

protected function drupalLogout() {
  if ($this
    ->config('bakery.settings')
    ->get('subsite_login')) {
    parent::drupalLogout();
  }
  else {

    // Assertions in the parent method won't work because logins are disabled
    // so just skip them.
    $this
      ->drupalGet(Url::fromRoute('user.logout'));

    // @see BrowserTestBase::drupalUserIsLoggedIn()
    unset($this->loggedInUser->sessionId);
    $this->loggedInUser = FALSE;
    \Drupal::currentUser()
      ->setAccount(new AnonymousUserSession());
  }
}