Elgg\Application\ServeFileHandlerTest::testSends403OnFileModificationTimeMismatch PHP Method

testSends403OnFileModificationTimeMismatch() public method

    public function testSends403OnFileModificationTimeMismatch()
    {
        $file = new \Elgg\FileService\File();
        $file->setFile($this->file);
        $request = $this->createRequest($file);
        $response = $this->handler->getResponse($request);
        $this->assertEquals(200, $response->getStatusCode());
        // Consecutive request will be send by the browswer with an etag header
        // We need to make sure we check modified time before issuing a Not Modified header
        // See issue #9571
        $request->headers->set('if_none_match', '"' . $this->file->getModifiedTime() . '"');
        sleep(1);
        // sometimes tests are too fast
        $this->file->setModifiedTime();
        $response = $this->handler->getResponse($request);
        $this->assertEquals(403, $response->getStatusCode());
    }