You are here

protected function ApigeeMockApiClientHelperTrait::queueDeveloperResponseFromDeveloper in Apigee Edge 8

Queues up a mock developer response.

Parameters

\Drupal\apigee_edge\Entity\DeveloperInterface $developer: The developer user to get properties from.

string|null $response_code: Add a response code to override the default.

Return value

\Drupal\user\Entity\User A user account with the same data as the created developer.

7 calls to ApigeeMockApiClientHelperTrait::queueDeveloperResponseFromDeveloper()
DeveloperTest::developerCreateByAdminTest in tests/src/Functional/DeveloperTest.php
Tests creating, editing and deleting developer entity by admin.
DeveloperTest::developerGetCompanyListTest in tests/src/Functional/DeveloperTest.php
Tests getCompanies() and hasCompany() methods on the developer entity.
DeveloperTest::tearDown in tests/src/Functional/DeveloperTest.php
EmailTest::editUserWithAlreadyExistingEmailTest in tests/src/Functional/EmailTest.php
Tests changing user's email to an already existing email address in Edge.
EmailTest::tearDown in tests/src/Functional/EmailTest.php

... See full list

File

tests/modules/apigee_mock_api_client/tests/src/Traits/ApigeeMockApiClientHelperTrait.php, line 182

Class

ApigeeMockApiClientHelperTrait
Helper functions working with Apigee tests.

Namespace

Drupal\Tests\apigee_mock_api_client\Traits

Code

protected function queueDeveloperResponseFromDeveloper(DeveloperInterface $developer, $response_code = NULL) {
  $account = $this->entityTypeManager
    ->getStorage('user')
    ->create([
    'mail' => $developer
      ->getEmail(),
    'name' => $developer
      ->getUserName(),
    'first_name' => $developer
      ->getFirstName(),
    'last_name' => $developer
      ->getLastName(),
    'status' => $developer
      ->getStatus() == DeveloperInterface::STATUS_ACTIVE ? 1 : 0,
  ]);
  $this
    ->queueDeveloperResponse($account, $response_code);
  return $account;
}