public function isFresh($timestamp) { if (!$this->maxTimestamp && !empty($this->resources)) { $this->maxTimestamp = max(array_map('filemtime', $this->resources)); } return $this->maxTimestamp <= $timestamp; }
/** * Tests that container resources can be added and isFresh works correctly */ public function testResourceManagement() { // Without resources this should be always true $isFresh = $this->container->isFresh(time()); $this->assertTrue($isFresh); $this->container->addResource(__FILE__); $realMtime = filemtime(__FILE__); $isFresh = $this->container->isFresh($realMtime - 3600); $this->assertFalse($isFresh); $isFresh = $this->container->isFresh($realMtime + 3600); $this->assertTrue($isFresh); }