Esempio n. 1
0
 public function __construct(Response $response)
 {
     $this->message = $response->getBody();
 }
Esempio n. 2
0
    public function assertStatusCode($expected, \Congow\Orient\Http\Response $got)
    {
        $message = "The status code of the response is wrong";

        return $this->assertEquals($expected, $got->getStatusCode(), $got->getBody());
    }
Esempio n. 3
0
    public function testnullIsReturnedWhenRequestingANonExistingHeader()
    {
        $response = new Http\Response("HTTP/1.1 200 OK\r\nCache-Control: max-age=30\r\nCache-Control: s-maxage=50\r\n\r\n");

        $this->assertEquals(null, $response->getHeader('Host'));
    }
Esempio n. 4
0
    /**
     * Checks whether the $response is valid.
     * A response is *not* considere valid when:
     * * it's void
     * * it returns a status code different from 2XX
     *
     * @param Response $response 
     */
    protected function checkResponse(Response $response = null)
    {
        if (!$response) {
            throw new VoidResponse(get_class($this->getClient()), $sql);
        }

        if (!in_array($response->getStatusCode(), $response->getValidStatusCodes())) {
            throw new InvalidSQL($response);   
        }
    }