fix directory resource considers same timestamp not fresh
This commit is contained in:
parent
96107e21f1
commit
d5746ecfd2
@ -68,7 +68,7 @@ class DirectoryResource implements ResourceInterface, \Serializable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($timestamp <= filemtime($this->resource)) {
|
if ($timestamp < filemtime($this->resource)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ class DirectoryResource implements ResourceInterface, \Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// early return if a file's mtime exceeds the passed timestamp
|
// early return if a file's mtime exceeds the passed timestamp
|
||||||
if ($timestamp <= $file->getMTime()) {
|
if ($timestamp < $file->getMTime()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,8 +96,10 @@ class DirectoryResourceTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testIsFreshDeleteFile()
|
public function testIsFreshDeleteFile()
|
||||||
{
|
{
|
||||||
$resource = new DirectoryResource($this->directory);
|
$resource = new DirectoryResource($this->directory);
|
||||||
|
$time = time();
|
||||||
|
sleep(1);
|
||||||
unlink($this->directory.'/tmp.xml');
|
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()
|
public function testIsFreshDeleteDirectory()
|
||||||
|
Reference in New Issue
Block a user