diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-10-10 15:34:19 +0200 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-10-20 11:29:20 +0200 |
commit | cb3a4d22b17ee3dd016faf52530b8f888cef5723 (patch) | |
tree | 8d8e3e7bdc95344dc87ab1e36f73d26616843f21 /apps/files_sharing/tests | |
parent | ca0e3fdfea51d8db52341c3866102e7058abc9c0 (diff) | |
download | nextcloud-server-cb3a4d22b17ee3dd016faf52530b8f888cef5723.tar.gz nextcloud-server-cb3a4d22b17ee3dd016faf52530b8f888cef5723.zip |
make tests compatible with hook based skeleton generation
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r-- | apps/files_sharing/tests/base.php | 33 |
1 files changed, 17 insertions, 16 deletions
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'); + } } /** |