public function EmailRegistrationLoginTest::testLoginWithUsername in Email Registration 8
Tests if an user can login with their username.
File
- tests/
src/ Functional/ Plugin/ Commerce/ CheckoutPane/ EmailRegistrationLoginTest.php, line 114
Class
- EmailRegistrationLoginTest
- Tests the login checkout pane.
Namespace
Drupal\Tests\email_registration\Functional\Plugin\Commerce\CheckoutPaneCode
public function testLoginWithUsername() {
// Allow users to login with their username.
$this
->config('email_registration.settings')
->set('login_with_username', TRUE)
->save();
// Create an user to login with.
$account = $this
->drupalCreateUser();
$this
->goToCheckout();
$this
->assertCheckoutProgressStep('Login');
$this
->assertSession()
->pageTextContains('Email address or username');
$edit = [
'email_registration_login[returning_customer][name]' => $account
->getAccountName(),
'email_registration_login[returning_customer][password]' => $account->passRaw,
];
$this
->submitForm($edit, 'Log in');
$this
->assertCheckoutProgressStep('Order information');
$this
->assertLoggedIn($account);
}