From cb3a4d22b17ee3dd016faf52530b8f888cef5723 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Fri, 10 Oct 2014 15:34:19 +0200 Subject: make tests compatible with hook based skeleton generation --- apps/files_sharing/tests/base.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'apps/files_sharing/tests') diff --git a/apps/files_sharing/tests/base.php b/apps/files_sharing/tests/base.php index 84de6006fdb..6bc02ec2008 100644 --- a/apps/files_sharing/tests/base.php +++ b/apps/files_sharing/tests/base.php @@ -37,7 +37,7 @@ abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase { const TEST_FILES_SHARING_API_GROUP1 = "test-share-group1"; - public $stateFilesEncryption; + public static $stateFilesEncryption; public $filename; public $data; /** @@ -48,6 +48,13 @@ abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase { public $subfolder; public static function setUpBeforeClass() { + + // remember files_encryption state + self::$stateFilesEncryption = \OC_App::isEnabled('files_encryption'); + + //we don't want to tests with app files_encryption enabled + \OC_App::disable('files_encryption'); + // reset backend \OC_User::clearBackends(); \OC_User::useBackend('database'); @@ -70,29 +77,16 @@ abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase { function setUp() { + $this->assertFalse(\OC_App::isEnabled('files_encryption')); + //login as user1 self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $this->data = 'foobar'; $this->view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files'); - // remember files_encryption state - $this->stateFilesEncryption = \OC_App::isEnabled('files_encryption'); - - //we don't want to tests with app files_encryption enabled - \OC_App::disable('files_encryption'); - - - $this->assertTrue(!\OC_App::isEnabled('files_encryption')); } function tearDown() { - // reset app files_encryption - if ($this->stateFilesEncryption) { - \OC_App::enable('files_encryption'); - } else { - \OC_App::disable('files_encryption'); - } - $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`'); $query->execute(); } @@ -106,6 +100,13 @@ abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase { // delete group \OC_Group::deleteGroup(self::TEST_FILES_SHARING_API_GROUP1); + + // reset app files_encryption + if (self::$stateFilesEncryption) { + \OC_App::enable('files_encryption'); + } else { + \OC_App::disable('files_encryption'); + } } /** -- cgit v1.2.3