You are here

public function ApigeeEdgeManagementCliServiceTest::testSetDefaultPermissions in Apigee Edge 8

Test setDefaultPermissions method.

Throws

\ReflectionException

File

tests/src/Unit/Command/Util/ApigeeEdgeManagementCliServiceTest.php, line 475

Class

ApigeeEdgeManagementCliServiceTest
Test ApigeeEdgeManagementCliService.

Namespace

Drupal\Tests\apigee_edge\Unit\Command\Util

Code

public function testSetDefaultPermissions() {

  // The permissions POST call will be made 12 times.
  $this->httpClient
    ->post(Argument::type('string'), Argument::type('array'))
    ->shouldBeCalledTimes(12);

  // Make method under test not private.
  $apigee_edge_management_cli_service = new ApigeeEdgeManagementCliService($this->httpClient
    ->reveal());
  $apigee_edge_management_cli_service_reflection = new \ReflectionClass($apigee_edge_management_cli_service);
  $method_set_default_permissions = $apigee_edge_management_cli_service_reflection
    ->getMethod('setDefaultPermissions');
  $method_set_default_permissions
    ->setAccessible(TRUE);

  // Create input params.
  $io = $this
    ->prophesize(StyleInterface::class);
  $args = [
    $io
      ->reveal(),
    [
      $this,
      'mockDt',
    ],
    $this->org,
    $this->email,
    $this->password,
    $this->baseUrl,
    $this->roleName,
  ];

  // Make call.
  $method_set_default_permissions
    ->invokeArgs($apigee_edge_management_cli_service, $args);
}