Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-08-16 18:24:06 +0300
committerRobin Appelman <robin@icewind.nl>2022-09-29 11:27:32 +0300
commit1de0b10751c55b26f3d9d0077e0eb404855c613c (patch)
treee05092f6e351f54c47ed686cdc6e217ce08795d4 /tests
parenta880f791d13702b69c19705f9d06eabb02a81f37 (diff)
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')
-rw-r--r--tests/lib/Files/ViewTest.php19
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'));
+ }
}