8000 [DependencyInjection] fixed Resource interface · Dahipster/symfony@63e7dda · GitHub
[go: up one dir, main page]

8000 Skip to content

Commit 63e7dda

Browse files
committed
[DependencyInjection] fixed Resource interface
1 parent bb3340d commit 63e7dda

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

src/Symfony/Components/DependencyInjection/FileResource.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,13 @@ public function getResource()
4949
*
5050
* @return Boolean true if the resource has not been updated, false otherwise
5151
*/
52-
public function isUptodate($timestamp = null)
52+
public function isUptodate($timestamp)
5353
{
5454
if (!file_exists($this->resource))
5555
{
5656
return false;
5757
}
5858

59-
if (null === $timestamp)
60-
{
61-
$timestamp = time();
62-
}
63-
6459
return filemtime($this->resource) < $timestamp;
6560
}
6661
}

src/Symfony/Components/DependencyInjection/ResourceInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface ResourceInterface
2727
*
2828
* @return Boolean true if the resource has not been updated, false otherwise
2929
*/
30-
function isUptodate($timestamp = null);
30+
function isUptodate($timestamp);
3131

3232
/**
3333
* Returns the resource tied to this Resource.

tests/unit/Symfony/Components/DependencyInjection/FileResourceTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
use Symfony\Components\DependencyInjection\FileResource;
1414

15-
$t = new LimeTest(5);
15+
$t = new LimeTest(4);
1616

1717
// ->getResource()
1818
$t->diag('->getResource()');
@@ -23,11 +23,9 @@
2323

2424
// ->isUptodate()
2525
$t->diag('->isUptodate()');
26-
sleep(1);
27-
$t->ok($resource->isUptodate(), '->isUptodate() returns true if the resource has not changed');
2826
$t->ok($resource->isUptodate(time() + 10), '->isUptodate() returns true if the resource has not changed');
2927
$t->ok(!$resource->isUptodate(time() - 86400), '->isUptodate() returns false if the resource has been updated');
3028
unlink($file);
3129

3230
$resource = new FileResource('/____foo/foobar'.rand(1, 999999));
33-
$t->ok(!$resource->isUptodate(), '->isUptodate() returns false if the resource does not exist');
31+
$t->ok(!$resource->isUptodate(time()), '->isUptodate() returns false if the resource does not exist');

0 commit comments

Comments
 (0)
0