From 54a3bdf1c5cab73fd9fbedbfb94c78c9f720855b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 7 Apr 2015 12:46:07 +0200 Subject: [PATCH] fixing unit test execution related to trashbin --- apps/files_trashbin/lib/storage.php | 2 +- tests/lib/avatar.php | 13 +++++++++++++ tests/lib/streamwrappers.php | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/apps/files_trashbin/lib/storage.php b/apps/files_trashbin/lib/storage.php index df80649a50..61e0816fd2 100644 --- a/apps/files_trashbin/lib/storage.php +++ b/apps/files_trashbin/lib/storage.php @@ -84,7 +84,7 @@ class Storage extends Wrapper { * @param string $path */ public function unlink($path) { - if (self::$disableTrash) { + if (self::$disableTrash || !\OC_App::isEnabled('files_trashbin')) { return $this->storage->unlink($path); } $normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path); diff --git a/tests/lib/avatar.php b/tests/lib/avatar.php index e852a7fc6f..9e1f367108 100644 --- a/tests/lib/avatar.php +++ b/tests/lib/avatar.php @@ -10,7 +10,9 @@ use OC\Avatar; class Test_Avatar extends \Test\TestCase { + private static $trashBinStatus; + /** @var @var string */ private $user; protected function setUp() { @@ -21,6 +23,17 @@ class Test_Avatar extends \Test\TestCase { \OC\Files\Filesystem::mount($storage, array(), '/' . $this->user . '/'); } + public static function setUpBeforeClass() { + self::$trashBinStatus = \OC_App::isEnabled('files_trashbin'); + \OC_App::disable('files_trashbin'); + } + + public static function tearDownAfterClass() { + if (self::$trashBinStatus) { + \OC_App::enable('files_trashbin'); + } + } + public function testAvatar() { $avatar = new Avatar($this->user); diff --git a/tests/lib/streamwrappers.php b/tests/lib/streamwrappers.php index 2a8c8676c1..fc3d02acae 100644 --- a/tests/lib/streamwrappers.php +++ b/tests/lib/streamwrappers.php @@ -21,6 +21,20 @@ */ class Test_StreamWrappers extends \Test\TestCase { + + private static $trashBinStatus; + + public static function setUpBeforeClass() { + self::$trashBinStatus = \OC_App::isEnabled('files_trashbin'); + \OC_App::disable('files_trashbin'); + } + + public static function tearDownAfterClass() { + if (self::$trashBinStatus) { + \OC_App::enable('files_trashbin'); + } + } + public function testFakeDir() { $items = array('foo', 'bar'); \OC\Files\Stream\Dir::register('test', $items);