Merge pull request #2742 from ss23/patch-1

Make CacheTest sleep properly
This commit is contained in:
Will Rossiter 2013-12-20 18:47:06 -08:00
commit 8b9f8cfd6f

View File

@ -27,7 +27,14 @@ class CacheTest extends SapphireTest {
$cache->save('Good', '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'));
}