mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Make CacheTest sleep properly
This way it will always sleep for the right amount of time (or longer)
This commit is contained in:
parent
588118ade5
commit
40163edba7
9
tests/cache/CacheTest.php
vendored
9
tests/cache/CacheTest.php
vendored
@ -27,7 +27,14 @@ class CacheTest extends SapphireTest {
|
|||||||
$cache->save('Good', 'cachekey');
|
$cache->save('Good', 'cachekey');
|
||||||
$this->assertEquals('Good', $cache->load('cachekey'));
|
$this->assertEquals('Good', $cache->load('cachekey'));
|
||||||
|
|
||||||
sleep(2);
|
// As per documentation, sleep may not sleep for the amount of time you tell it to sleep for
|
||||||
|
// This loop can make sure it *does* sleep for that long
|
||||||
|
$endtime = time() + 2;
|
||||||
|
while (time() < $endtime) {
|
||||||
|
// Sleep for another 2 seconds!
|
||||||
|
// This may end up sleeping for 4 seconds, but it's awwwwwwwright.
|
||||||
|
sleep(2);
|
||||||
|
}
|
||||||
|
|
||||||
$this->assertFalse($cache->load('cachekey'));
|
$this->assertFalse($cache->load('cachekey'));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user