コード例 #1
0
ファイル: ClientTest.php プロジェクト: staabm/sabre-http
 function testHttpErrorException()
 {
     $client = new ClientMock();
     $client->setThrowExceptions(true);
     $request = new Request('GET', 'http://example.org/');
     $client->on('doRequest', function ($request, &$response) {
         $response = new Response(404);
     });
     try {
         $client->send($request);
         $this->fail('An exception should have been thrown');
     } catch (ClientHttpException $e) {
         $this->assertEquals(404, $e->getHttpStatus());
         $this->assertInstanceOf('Sabre\\HTTP\\Response', $e->getResponse());
     }
 }