fix directory resource considers same timestamp not fresh

This commit is contained in:
Rob Frawley 2nd 2017-01-30 13:31:59 -05:00
parent 96107e21f1
commit d5746ecfd2
No known key found for this signature in database
GPG Key ID: 0EC41426CA2BA4E4
2 changed files with 5 additions and 3 deletions

View File

@ -68,7 +68,7 @@ class DirectoryResource implements ResourceInterface, \Serializable
return false;
}
if ($timestamp <= filemtime($this->resource)) {
if ($timestamp < filemtime($this->resource)) {
return false;
}
@ -85,7 +85,7 @@ class DirectoryResource implements ResourceInterface, \Serializable
}
// early return if a file's mtime exceeds the passed timestamp
if ($timestamp <= $file->getMTime()) {
if ($timestamp < $file->getMTime()) {
return false;
}
}

View File

@ -96,8 +96,10 @@ class DirectoryResourceTest extends \PHPUnit_Framework_TestCase
public function testIsFreshDeleteFile()
{
$resource = new DirectoryResource($this->directory);
$time = time();
sleep(1);
unlink($this->directory.'/tmp.xml');
$this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if an existing file is removed');
$this->assertFalse($resource->isFresh($time), '->isFresh() returns false if an existing file is removed');
}
public function testIsFreshDeleteDirectory()