/** * Dispatches the request and sends the response to the client if the * system is not being tested. * * @return */ public function dispatch() { try { $this->dispatchController($this->api->prepare); $this->routeRequest(); } catch (\Exception $exception) { $this->dispatchController($this->api->error, $exception); } if (!$this->api->testing) { $this->sender->send(); } }
/** * @expectedException \ErrorException */ function testCacheMissWithNewerModification() { $this->response->setHeader("Last-Modified", "Sun, 25 Aug 2013 18:33:31 GMT"); $this->response->whenCacheMissed(function () { throw new \ErrorException(); }); $this->request->mock(array("HTTP_IF_MODIFIED_SINCE" => "Sun, 25 Aug 2013 18:33:30 GMT")); $this->sender->send(); }