You are here

protected function EmailRegistrationLoginTest::assertLoggedIn in Email Registration 8

Asserts that a particular user is logged in.

Parameters

\Drupal\Core\Session\AccountInterface $account: The account to check for being logged in.

3 calls to EmailRegistrationLoginTest::assertLoggedIn()
EmailRegistrationLoginTest::drupalLogin in tests/src/Functional/Plugin/Commerce/CheckoutPane/EmailRegistrationLoginTest.php
Logs in a user using the Mink controlled browser.
EmailRegistrationLoginTest::testLoginWithMailAddress in tests/src/Functional/Plugin/Commerce/CheckoutPane/EmailRegistrationLoginTest.php
Tests if an user can login with their email address.
EmailRegistrationLoginTest::testLoginWithUsername in tests/src/Functional/Plugin/Commerce/CheckoutPane/EmailRegistrationLoginTest.php
Tests if an user can login with their username.

File

tests/src/Functional/Plugin/Commerce/CheckoutPane/EmailRegistrationLoginTest.php, line 300

Class

EmailRegistrationLoginTest
Tests the login checkout pane.

Namespace

Drupal\Tests\email_registration\Functional\Plugin\Commerce\CheckoutPane

Code

protected function assertLoggedIn(AccountInterface $account) {
  $account->sessionId = $this
    ->getSession()
    ->getCookie(\Drupal::service('session_configuration')
    ->getOptions(\Drupal::request())['name']);
  $this
    ->assertTrue($this
    ->drupalUserIsLoggedIn($account), new FormattableMarkup('User %name successfully logged in.', [
    '%name' => $account
      ->getAccountName(),
  ]));
  $this->loggedInUser = $account;
  $this->container
    ->get('current_user')
    ->setAccount($account);
}