public function testSettersAndGetters()
 {
     // Status
     $status = true;
     $this->response->setStatus($status);
     $this->assertSame($status, $this->response->getStatus());
     // Error
     $error = 'missing-value';
     $this->response->setError($error);
     $this->assertSame($error, $this->response->getError());
 }
Exemplo n.º 2
0
 public function testConstructorWithHttpResponse()
 {
     $params = array('success' => true, 'error' => 'error');
     $httpResponse = new Response();
     $httpResponse->setStatusCode(200);
     $httpResponse->getHeaders()->addHeaderLine('Content-Type', 'text/html');
     $httpResponse->setContent(json_encode($params));
     $response = new CaptchaResponse($httpResponse);
     $this->assertSame(true, $response->getStatus());
     $this->assertSame($params['error'], $response->getError());
 }