public function test_outputResponse_shouldNotOutputAnything_IfExceptionResponseAlreadySent()
 {
     $tracker = $this->getTrackerWithCountedRequests();
     $this->response->outputException($tracker, new Exception('My Custom Message'), 400);
     $this->response->outputResponse($tracker);
     $content = $this->response->getOutput();
     $this->assertEquals('{"status":"error","tracked":5,"invalid":0}', $content);
 }
示例#2
0
 public function test_outputResponse_shouldIncludeInvalidIndices_IfExceptionSet_AndRequestAuthenticated()
 {
     $tracker = $this->getTrackerWithCountedRequests();
     $this->response->setInvalidRequests(array(10, 20));
     $this->response->setIsAuthenticated(true);
     $this->response->outputException($tracker, new Exception('My Custom Message'), 400);
     $content = $this->response->getOutput();
     $this->assertEquals('{"status":"error","tracked":5,"invalid":2,"invalid_indices":[10,20]}', $content);
 }