Exemple #1
0
 /**
  * testServerError method
  *
  * @return void
  */
 public function testServerError()
 {
     $response = new Att\M2X\HttpResponse($this->_raw('internal_server_error'));
     $this->assertEquals(500, $response->status());
     $this->assertFalse($response->success());
     $this->assertFalse($response->clientError());
     $this->assertTrue($response->serverError());
     $this->assertTrue($response->error());
 }
Exemple #2
0
 /**
  * Checks the HttpResponse for errors and throws an exception, if
  * no errors are encountered, the HttpResponse is returned.
  *
  * @param HttpResponse $response
  * @return HttpResponse
  * @throws M2XException
  */
 protected function handleResponse(HttpResponse $response)
 {
     $this->lastResponse = $response;
     if ($response->success()) {
         return $response;
     }
     throw new M2XException($response);
 }