You are here

public function EmailRegistrationLoginTest::testLoginWithMailAddress in Email Registration 8

Tests if an user can login with their email address.

File

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

Class

EmailRegistrationLoginTest
Tests the login checkout pane.

Namespace

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

Code

public function testLoginWithMailAddress() {

  // Create an user to login with.
  $account = $this
    ->drupalCreateUser();
  $this
    ->goToCheckout();
  $this
    ->assertCheckoutProgressStep('Login');
  $edit = [
    'email_registration_login[returning_customer][name]' => $account
      ->getEmail(),
    'email_registration_login[returning_customer][password]' => $account->passRaw,
  ];
  $this
    ->submitForm($edit, 'Log in');
  $this
    ->assertCheckoutProgressStep('Order information');
  $this
    ->assertLoggedIn($account);
}