You are here

protected function TeamListBuilderTest::createNewAccount in Apigee Edge 8

Helper function to create a random user account.

Return value

\Drupal\Core\Entity\EntityInterface The user account.

1 call to TeamListBuilderTest::createNewAccount()
TeamListBuilderTest::setUp in modules/apigee_edge_teams/tests/src/Functional/TeamListBuilderTest.php

File

modules/apigee_edge_teams/tests/src/Functional/TeamListBuilderTest.php, line 218

Class

TeamListBuilderTest
Apigee Edge Teams list builder tests.

Namespace

Drupal\Tests\apigee_edge_teams\Functional

Code

protected function createNewAccount() {
  $this
    ->disableUserPresave();
  $account = $this
    ->createAccount();
  $fields = [
    'email' => $account
      ->getEmail(),
    'userName' => $account
      ->getAccountName(),
    'firstName' => $this
      ->getRandomGenerator()
      ->word(8),
    'lastName' => $this
      ->getRandomGenerator()
      ->word(8),
  ];

  // Stack developer responses for "created" and "set active".
  $this
    ->queueDeveloperResponse($account, Response::HTTP_CREATED);
  $this->stack
    ->queueMockResponse('no_content');
  $developer = Developer::create($fields);
  $developer
    ->save();
  return $account;
}