You are here

public function ChildLoginTest::ttestAccountCreation in Bakery Single Sign-On System 8.2

File

tests/src/Functional/ChildLoginTest.php, line 65

Class

ChildLoginTest

Namespace

Drupal\Tests\bakery\Functional

Code

public function ttestAccountCreation() {
  $this
    ->markTestIncomplete('This can not currently work during a request because it can not talk to a main site.');
  $assert_session = $this
    ->assertSession();
  $valid_init = 'drupal.org/user/123/edit';

  // Miss-matched username should not log in.
  $this
    ->bakeCookie(new ChocolateChip('tester', 'test@example.com', $valid_init, '1'));
  $this
    ->drupalGet('');
  $this
    ->drupalGet('');
  $assert_session
    ->responseContains('Tester');

  /** @var \Drupal\user\UserStorageInterface $user_storage */
  $user_storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('user');
  $user = $user_storage
    ->loadByProperties([
    'name' => 'tester',
  ]);
  $this
    ->assertEquals('test@example.com', $user[0]
    ->getEamil());
  $this
    ->assertEquals($valid_init, $user[0]
    ->getInitialEmail());
}