Example #1
0
 /**
  * @test
  */
 public function can_throw_request_error()
 {
     $descriptor = new Descriptor("http://localhost:1", "delete", array("header1" => "value1", "header2" => "value2"), "this is a body");
     $portatext = new Client();
     try {
         $portatext->execute($descriptor);
     } catch (\PortaText\Exception\RequestError $e) {
         $eDescriptor = $e->getDescriptor();
         $this->assertTrue(strlen($e->getMessage()) > 10);
         $this->assertEquals($eDescriptor->uri, $descriptor->uri);
         $this->assertEquals($eDescriptor->method, $descriptor->method);
         $this->assertEquals($eDescriptor->headers, $descriptor->headers);
         $this->assertEquals($eDescriptor->body, $descriptor->body);
         $this->assertNull($e->getResult());
     }
 }