function SecurepagesTest::drupalLoginHttps in Secure Pages 8
Log in a user with the internal browser using HTTPS.
Parameters
\Drupal\Core\Session\AccountInterface $account: User object representing the user to log in.
See also
\Drupal\simpletest\WebTestBase::drupalLogin().
2 calls to SecurepagesTest::drupalLoginHttps()
- SecurepagesTest::_testRoles in src/
Tests/ SecurepagesTest.php - Test role-based switching.
- SecurepagesTest::_testSettingsForm in src/
Tests/ SecurepagesTest.php - Test submitting the settings form.
File
- src/
Tests/ SecurepagesTest.php, line 364 - Contains \Drupal\securepages\Tests\SecurepagesTest.
Class
- SecurepagesTest
- Test Secure Pages redirects.
Namespace
Drupal\securepages\TestsCode
function drupalLoginHttps($account) {
if ($this->loggedInUser) {
$this
->drupalLogout();
}
$edit = array(
'name' => $account
->getAccountName(),
'pass' => $account->pass_raw,
);
$this
->drupalPostForm(Securepages::getUrl('user.login'), $edit, t('Log in'));
// @see WebTestBase::drupalUserIsLoggedIn()
if (isset($this->sessionId)) {
$account->session_id = $this->sessionId;
}
$pass = $this
->assertRaw('>' . $account
->getAccountName() . '<', t('User %name successfully logged in.', array(
'%name' => $account
->getAccountName(),
)), 'User login');
if ($pass) {
$this->loggedInUser = $account;
$this->container
->get('current_user')
->setAccount($account);
}
}