From 0a3e0a1665f2c1faffd94ba0beb3dd2d6b0a465a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 15 Jan 2015 18:46:42 +0100 Subject: [PATCH] Additional unit test for recursive remove --- tests/lib/files/cache/cache.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/lib/files/cache/cache.php b/tests/lib/files/cache/cache.php index 6df98ee531d..15bcff24f36 100644 --- a/tests/lib/files/cache/cache.php +++ b/tests/lib/files/cache/cache.php @@ -143,6 +143,25 @@ class Cache extends \Test\TestCase { $this->assertFalse($this->cache->inCache($folder.'/bar')); } + public function testRemoveRecursive() { + $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $fileData = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'text/plain'); + $folders = ['folder', 'folder/subfolder', 'folder/sub2', 'folder/sub2/sub3']; + $files = ['folder/foo.txt', 'folder/bar.txt', 'folder/subfolder/asd.txt', 'folder/sub2/qwerty.txt', 'folder/sub2/sub3/foo.txt']; + + foreach($folders as $folder){ + $this->cache->put($folder, $folderData); + } + foreach ($files as $file) { + $this->cache->put($file, $fileData); + } + + $this->cache->remove('folder'); + foreach ($files as $file) { + $this->assertFalse($this->cache->inCache($file)); + } + } + public function folderDataProvider() { return array( -- 2.39.5