public function ChildSitePagesTest::testPages in Bakery Single Sign-On System 8.2
Test some pages.
File
- tests/
src/ Functional/ ChildSitePagesTest.php, line 14
Class
Namespace
Drupal\Tests\bakery\FunctionalCode
public function testPages() {
$assert_session = $this
->assertSession();
$this
->drupalGet('/bakery/repair');
$assert_session
->statusCodeEquals(403);
// Trigger a bad account to repair.
$account = $this
->createUser([], NULL, FALSE, [
'mail' => '',
]);
$this
->bakeCookie(new ChocolateChip($account
->getAccountName(), 'test@example.com', $account
->getInitialEmail(), '1'));
$this
->drupalGet('');
$assert_session
->pageTextContains('Would you like to try to repair it yourself?');
$assert_session
->linkByHrefExists('/bakery/repair');
$this
->drupalGet('/bakery/repair');
// Repair account and confirm it gets logged in.
$this
->submitForm([
'pass' => $account
->getPassword(),
], 'Repair account');
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains($account
->getAccountName());
// Repaired account able to login.
$this
->drupalLogout();
$this
->bakeCookie(new ChocolateChip($account
->getAccountName(), 'test@example.com', $account
->getInitialEmail(), '1'));
$this
->drupalGet('');
$assert_session
->responseContains($account
->getAccountName());
}