/** * @group FileService */ 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()); }
/** * @group FileService */ public function testCanSetModifiedTime() { $time = $this->file->getModifiedTime(); $this->file->setModifiedTime(); $this->assertNotEquals($time, $this->file->getModifiedTime()); }