mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
fix: stabilize filesystem touch test
This commit is contained in:
1 parent
bef0ec00c4
commit
759794356e
2 files changed
+10
-4
No files matched your search
@@ -106,7 +106,13 @@ class Filesystem implements Adapter
|
||||
{
|
||||
$file = $this->getPath($key);
|
||||
|
||||
return file_exists($file) && touch($file);
|
||||
if (! file_exists($file) || ! touch($file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
clearstatcache(true, $file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,11 +62,11 @@ abstract class Base extends TestCase
|
||||
$result = self::$cache->save('touch-key', 'touch data', 'touch-key');
|
||||
$this->assertEquals('touch data', $result);
|
||||
|
||||
sleep(2);
|
||||
sleep(3);
|
||||
|
||||
$this->assertEquals(false, self::$cache->load('touch-key', 1, 'touch-key'));
|
||||
$this->assertEquals(false, self::$cache->load('touch-key', 2, 'touch-key'));
|
||||
$this->assertEquals(true, self::$cache->touch('touch-key', 'touch-key'));
|
||||
$this->assertEquals('touch data', self::$cache->load('touch-key', 1, 'touch-key'));
|
||||
$this->assertEquals('touch data', self::$cache->load('touch-key', 2, 'touch-key'));
|
||||
$this->assertEquals(false, self::$cache->touch('missing-touch-key', 'missing-touch-key'));
|
||||
|
||||
self::$cache->purge('touch-key');
|
||||
|
||||
Reference in new issue
Block a user