public function testFetchInvalidStatusCodeThrowsException() { $request = new Request(); $request->setUri('http://test.dev/testapi/17'); $request->setMethod(Request::METHOD_GET); $request->getHeaders()->addHeaders(array('Accept' => 'application/json')); $response = new Response(); $response->setContent(json_encode(['type' => 'http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html', 'title' => 'Forbidden', 'status' => 403, 'detail' => 'Forbidden'])); $httpClient = $this->getMock('Zend\\Http\\Client', array('send')); $httpClient->expects($this->once())->method('send')->with($this->equalTo($request))->will($this->returnValue($response)); $client = new Client($httpClient, 'http://test.dev/', ['Accept' => 'application/json']); $client->setThrowExceptions(true); $this->expectException('Jolicht\\ApigilityClient\\ClientException'); $this->expectExceptionCode(403); $this->expectExceptionMessage('Forbidden'); $client->fetch('/testapi', 17); }