public function ApigeeEdgeManagementCliServiceTest::testHandleHttpClientExceptions403Code in Apigee Edge 8
Make sure method outputs more info for error codes.
File
- tests/
src/ Unit/ Command/ Util/ ApigeeEdgeManagementCliServiceTest.php, line 435
Class
- ApigeeEdgeManagementCliServiceTest
- Test ApigeeEdgeManagementCliService.
Namespace
Drupal\Tests\apigee_edge\Unit\Command\UtilCode
public function testHandleHttpClientExceptions403Code() {
// Server returns 403 forbidden.
$request = $this
->prophesize(RequestInterface::class);
$response = $this
->prophesize(Response::class);
$response
->getStatusCode()
->willReturn(403);
$exception = new ClientException('Forbidden', $request
->reveal(), $response
->reveal());
// Expect error messages.
$io = $this
->prophesize(StyleInterface::class);
$io
->error(Argument::containingString('Error connecting to Apigee Edge'))
->shouldBeCalledTimes(1);
$io
->note(Argument::containingString('User ' . $this->email . ' may not have the orgadmin role'))
->shouldBeCalledTimes(1);
$apigee_edge_management_cli_service = new ApigeeEdgeManagementCliService($this->httpClient
->reveal());
$apigee_edge_management_cli_service
->handleHttpClientExceptions($exception, $io
->reveal(), [
$this,
'mockDt',
], 'http://api.apigee.com/test', $this->org, $this->email);
}