assertInstanceOf('OpenStack\Common\Transport\Guzzle\HttpError', $sub); } private function getEvent() { return new CompleteEvent(new Transaction(new Client(), new Request('GET', '/'))); } public function testSuccessfulResponsesThrowNothing() { $event = $this->getEvent(); $event->intercept(new Response(200)); (new HttpError())->onComplete($event); } /** * @expectedException \OpenStack\Common\Transport\Exception\ConflictException */ public function testConflictExceptionRaisedFor409Error() { $event = $this->getEvent(); $event->intercept(new Response(409)); (new HttpError())->onComplete($event); } /** * @expectedException \OpenStack\Common\Transport\Exception\ForbiddenException */ public function testConflictExceptionRaisedFor403Error() { $event = $this->getEvent(); $event->intercept(new Response(403)); (new HttpError())->onComplete($event); } /** * @expectedException \OpenStack\Common\Transport\Exception\LengthRequiredException */ public function testConflictExceptionRaisedFor411Error() { $event = $this->getEvent(); $event->intercept(new Response(411)); (new HttpError())->onComplete($event); } /** * @expectedException \OpenStack\Common\Transport\Exception\MethodNotAllowedException */ public function testConflictExceptionRaisedFor405Error() { $event = $this->getEvent(); $event->intercept(new Response(405)); (new HttpError())->onComplete($event); } /** * @expectedException \OpenStack\Common\Transport\Exception\ResourceNotFoundException */ public function testConflictExceptionRaisedFor404Error() { $event = $this->getEvent(); $event->intercept(new Response(404)); (new HttpError())->onComplete($event); } /** * @expectedException \OpenStack\Common\Transport\Exception\ServerException */ public function testConflictExceptionRaisedFor500Error() { $event = $this->getEvent(); $event->intercept(new Response(500)); (new HttpError())->onComplete($event); } /** * @expectedException \OpenStack\Common\Transport\Exception\UnauthorizedException */ public function testConflictExceptionRaisedFor401Error() { $event = $this->getEvent(); $event->intercept(new Response(401)); (new HttpError())->onComplete($event); } /** * @expectedException \OpenStack\Common\Transport\Exception\UnprocessableEntityException */ public function testConflictExceptionRaisedFor422Error() { $event = $this->getEvent(); $event->intercept(new Response(422)); (new HttpError())->onComplete($event); } }