]> source.dussan.org Git - nextcloud-server.git/commitdiff
Additional unit test for recursive remove
authorRobin Appelman <icewind@owncloud.com>
Thu, 15 Jan 2015 17:46:42 +0000 (18:46 +0100)
committerRobin Appelman <icewind@owncloud.com>
Thu, 15 Jan 2015 17:47:05 +0000 (18:47 +0100)
tests/lib/files/cache/cache.php

index 6df98ee531d8cb8b93169adbba7fd1653772cf53..15bcff24f364b95c87cf81a08e03eb9cc2a898b3 100644 (file)
@@ -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(