ChildSitePagesTest.php in Bakery Single Sign-On System 8.2
File
tests/src/Functional/ChildSitePagesTest.php
View source
<?php
namespace Drupal\Tests\bakery\Functional;
use Drupal\bakery\Cookies\ChocolateChip;
class ChildSitePagesTest extends ChildSiteTestBase {
protected $defaultTheme = 'stark';
public function testPages() {
$assert_session = $this
->assertSession();
$this
->drupalGet('/bakery/repair');
$assert_session
->statusCodeEquals(403);
$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');
$this
->submitForm([
'pass' => $account
->getPassword(),
], 'Repair account');
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains($account
->getAccountName());
$this
->drupalLogout();
$this
->bakeCookie(new ChocolateChip($account
->getAccountName(), 'test@example.com', $account
->getInitialEmail(), '1'));
$this
->drupalGet('');
$assert_session
->responseContains($account
->getAccountName());
}
}