diff options
author | Robin Appelman <robin@icewind.nl> | 2022-08-16 17:24:06 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-09-29 10:27:32 +0200 |
commit | 1de0b10751c55b26f3d9d0077e0eb404855c613c (patch) | |
tree | e05092f6e351f54c47ed686cdc6e217ce08795d4 /tests/lib/Files | |
parent | a880f791d13702b69c19705f9d06eabb02a81f37 (diff) | |
download | nextcloud-server-1de0b10751c55b26f3d9d0077e0eb404855c613c.tar.gz nextcloud-server-1de0b10751c55b26f3d9d0077e0eb404855c613c.zip |
add test for trying to fopen a file which no longer exists on disk
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Files')
-rw-r--r-- | tests/lib/Files/ViewTest.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index 86101d79a1e..2189e7c09f4 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -2709,4 +2709,23 @@ class ViewTest extends \Test\TestCase { $this->assertEquals(25, $info->getUploadTime()); $this->assertEquals(0, $info->getCreationTime()); } + + public function testFopenGone() { + $storage = new Temporary([]); + $scanner = $storage->getScanner(); + $storage->file_put_contents('foo.txt', 'bar'); + $scanner->scan(''); + $cache = $storage->getCache(); + + Filesystem::mount($storage, [], '/test/'); + $view = new View('/test'); + + $storage->unlink('foo.txt'); + + $this->assertTrue($cache->inCache('foo.txt')); + + $this->assertFalse($view->fopen('foo.txt', 'r')); + + $this->assertFalse($cache->inCache('foo.txt')); + } } |