예제 #1
0
파일: TestCase.php 프로젝트: Reinmar/Orient
    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());
    }
예제 #2
0
    public function testGettingTheStatusCode()
    {
        $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("200", $response->getStatusCode());
    }
예제 #3
0
파일: Http.php 프로젝트: Reinmar/Orient
    /**
     * 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);   
        }
    }