withHeader('If-Modified-Since', '2012-01-01 00:00:00') ->withHeader('If-None-Match', '*'); $this->Controller = new Controller($request); $this->Component = new CheckHttpCacheComponent($this->Controller->components()); } public function testBeforeRenderSuccess() { $response = $this->Controller->getResponse() ->withEtag('something', true); $this->Controller->setResponse($response); $event = new Event('Controller.beforeRender', $this->Controller); $this->Component->beforeRender($event); $this->assertTrue($event->isStopped()); $response = $this->Controller->getResponse(); $this->assertSame(304, $response->getStatusCode()); } public function testBeforeRenderNoOp() { $event = new Event('Controller.beforeRender', $this->Controller); $this->Component->beforeRender($event); $this->assertFalse($event->isStopped()); $response = $this->Controller->getResponse(); $this->assertSame(200, $response->getStatusCode()); } }