Safe teardowns

This commit is contained in:
Robin Appelman 2015-12-02 14:49:27 +01:00
parent 3ab0ccd4a2
commit 5d0451b848
6 changed files with 28 additions and 16 deletions

View 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();
}

View File

@ -75,7 +75,9 @@ class Cache extends TestCase {
}
protected function tearDown() {
$this->cache->clear();
if ($this->cache) {
$this->cache->clear();
}
parent::tearDown();
}

View 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();
}

View 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();
}

View 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();
}

View 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();