summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/ViewTest.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 8ec9619087c..4cdea59da0d 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -515,6 +515,30 @@ class ViewTest extends \Test\TestCase {
$this->assertFalse($rootView->file_exists('substorage/bar.txt'));
}
+ public function rmdirOrUnlinkDataProvider() {
+ return [['rmdir'], ['unlink']];
+ }
+
+ /**
+ * @dataProvider rmdirOrUnlinkDataProvider
+ */
+ public function testRmdir($method) {
+ $storage1 = $this->getTestStorage();
+ $storage2 = $this->getTestStorage();
+ Filesystem::mount($storage1, [], '/');
+
+ $rootView = new View('');
+ $rootView->mkdir('sub');
+ $rootView->mkdir('sub/deep');
+ $rootView->file_put_contents('/sub/deep/foo.txt', 'asd');
+
+ $this->assertTrue($rootView->file_exists('sub/deep/foo.txt'));
+
+ $this->assertTrue($rootView->$method('sub'));
+
+ $this->assertFalse($rootView->file_exists('sub'));
+ }
+
/**
* @medium
*/