public function ApigeeEdgeManagementCliServiceTest::testDoesRoleExistTrue in Apigee Edge 8
Validate doesRoleExist works when role does not exist.
File
- tests/
src/ Unit/ Command/ Util/ ApigeeEdgeManagementCliServiceTest.php, line 343
Class
- ApigeeEdgeManagementCliServiceTest
- Test ApigeeEdgeManagementCliService.
Namespace
Drupal\Tests\apigee_edge\Unit\Command\UtilCode
public function testDoesRoleExistTrue() {
// Return existing role.
$response_user_role = $this
->prophesize(Response::class);
$response_user_role
->getBody()
->willReturn('{ "name": "' . $this->roleName . '" }');
$this->httpClient
->get(Argument::exact($this->baseUrl . '/o/' . $this->org . '/userroles/' . $this->roleName), Argument::type('array'))
->shouldBeCalledTimes(1)
->willReturn($response_user_role
->reveal());
$apigee_edge_management_cli_service = new ApigeeEdgeManagementCliService($this->httpClient
->reveal());
$does_role_exist = $apigee_edge_management_cli_service
->doesRoleExist($this->org, $this->email, $this->password, $this->baseUrl, $this->roleName);
// Assert returned true.
$this
->assertEquals(TRUE, $does_role_exist, 'Method doesRoleExist() should return true when role exists.');
}