]> source.dussan.org Git - nextcloud-server.git/commitdiff
Safe teardowns
authorRobin Appelman <icewind@owncloud.com>
Wed, 2 Dec 2015 13:49:27 +0000 (14:49 +0100)
committerRobin Appelman <icewind@owncloud.com>
Thu, 14 Jan 2016 11:54:42 +0000 (12:54 +0100)
apps/files_sharing/tests/backend.php
apps/files_sharing/tests/external/cache.php
apps/files_sharing/tests/sharedmount.php
apps/files_sharing/tests/updater.php
apps/files_sharing/tests/watcher.php
apps/files_versions/tests/versions.php

index 0e151d9e76ab55af815e1d42e52a2275e68d1da4..acb59855394723eb68164e686ea1cc19631b61d9 100644 (file)
@@ -58,8 +58,10 @@ class Test_Files_Sharing_Backend extends TestCase {
        }
 
        protected function tearDown() {
-               $this->view->unlink($this->filename);
-               $this->view->deleteAll($this->folder);
+               if ($this->view) {
+                       $this->view->unlink($this->filename);
+                       $this->view->deleteAll($this->folder);
+               }
 
                parent::tearDown();
        }
index 52e01677fa3c9c72f031f0301d4f0a441acb43bf..3e078bf3722b96bf5014e0a0e40db2af8ee11ba0 100644 (file)
@@ -75,7 +75,9 @@ class Cache extends TestCase {
        }
 
        protected function tearDown() {
-               $this->cache->clear();
+               if ($this->cache) {
+                       $this->cache->clear();
+               }
                parent::tearDown();
        }
 
index 347ec0d2a7b0b023aa8e5ebbf121e61e258a59cc..e01deeb60f44ec33fac7aec88b909eca79aeb6d3 100644 (file)
@@ -48,8 +48,10 @@ class Test_Files_Sharing_Mount extends OCA\Files_sharing\Tests\TestCase {
        }
 
        protected function tearDown() {
-               $this->view->unlink($this->folder);
-               $this->view->unlink($this->filename);
+               if ($this->view) {
+                       $this->view->unlink($this->folder);
+                       $this->view->unlink($this->filename);
+               }
 
                parent::tearDown();
        }
index 02c5f487e0ade83e36ae7dd2f35eab15e395269a..dd1f83c99a836b0d30b0679b14efeba92813c446 100644 (file)
@@ -52,8 +52,10 @@ class Test_Files_Sharing_Updater extends OCA\Files_Sharing\Tests\TestCase {
        }
 
        protected function tearDown() {
-               $this->view->unlink($this->filename);
-               $this->view->deleteAll($this->folder);
+               if ($this->view) {
+                       $this->view->unlink($this->filename);
+                       $this->view->deleteAll($this->folder);
+               }
 
                parent::tearDown();
        }
index 021f10bacca91beb30c3608a0ce27afa9ee9c3e9..247fb59f3517ed8187159b726496781a1a8bad9b 100644 (file)
@@ -88,13 +88,15 @@ class Test_Files_Sharing_Watcher extends OCA\Files_sharing\Tests\TestCase {
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
 
-               $fileinfo = $this->view->getFileInfo('container/shareddir');
-               \OCP\Share::unshare('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
-                       self::TEST_FILES_SHARING_API_USER2);
+               if ($this->view) {
+                       $fileinfo = $this->view->getFileInfo('container/shareddir');
+                       \OCP\Share::unshare('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
+                                       self::TEST_FILES_SHARING_API_USER2);
 
-               $this->view->deleteAll('container');
+                       $this->view->deleteAll('container');
 
-               $this->ownerCache->clear();
+                       $this->ownerCache->clear();
+               }
 
                parent::tearDown();
        }
index 74d6006cfd9c72e9b8208e0afc60e9de5e2bba62..ac922b74b9fbc872f5b23f9bb98c7d5719e0c979 100644 (file)
@@ -86,10 +86,12 @@ class Test_Files_Versioning extends \Test\TestCase {
        }
 
        protected function tearDown() {
-               $this->rootView->deleteAll(self::TEST_VERSIONS_USER . '/files/');
-               $this->rootView->deleteAll(self::TEST_VERSIONS_USER2 . '/files/');
-               $this->rootView->deleteAll(self::TEST_VERSIONS_USER . '/files_versions/');
-               $this->rootView->deleteAll(self::TEST_VERSIONS_USER2 . '/files_versions/');
+               if ($this->rootView) {
+                       $this->rootView->deleteAll(self::TEST_VERSIONS_USER . '/files/');
+                       $this->rootView->deleteAll(self::TEST_VERSIONS_USER2 . '/files/');
+                       $this->rootView->deleteAll(self::TEST_VERSIONS_USER . '/files_versions/');
+                       $this->rootView->deleteAll(self::TEST_VERSIONS_USER2 . '/files_versions/');
+               }
 
                \OC_Hook::clear();