Ejemplo n.º 1
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $application = new Application();
     $application->registerMountProviders();
     // reset backend
     \OC_User::clearBackends();
     \OC_Group::clearBackends();
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     // create users
     $backend = new \Test\Util\User\Dummy();
     \OC_User::useBackend($backend);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER1);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER2);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER3);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER4, self::TEST_FILES_SHARING_API_USER4);
     // create group
     $groupBackend = new \OC_Group_Dummy();
     $groupBackend->createGroup(self::TEST_FILES_SHARING_API_GROUP1);
     $groupBackend->createGroup('group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER1, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER3, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_GROUP1);
     \OC_Group::useBackend($groupBackend);
 }
Ejemplo n.º 2
0
 public static function setUpBeforeClass()
 {
     parent::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');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     // create users
     $backend = new \OC_User_Dummy();
     \OC_User::useBackend($backend);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER1);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER2);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER3);
     // create group
     $groupBackend = new \OC_Group_Dummy();
     $groupBackend->createGroup(self::TEST_FILES_SHARING_API_GROUP1);
     $groupBackend->createGroup('group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER1, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER3, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_GROUP1);
     \OC_Group::useBackend($groupBackend);
 }
Ejemplo n.º 3
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // enable resharing
     \OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', 'yes');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     // register share hooks
     \OC::registerShareHooks();
     \OCA\Files_Sharing\Helper::registerHooks();
     // Sharing related hooks
     \OCA\Encryption\Helper::registerShareHooks();
     // Filesystem related hooks
     \OCA\Encryption\Helper::registerFilesystemHooks();
     // clear and register hooks
     \OC_FileProxy::clearProxies();
     \OC_FileProxy::register(new OCA\Files\Share\Proxy());
     \OC_FileProxy::register(new OCA\Encryption\Proxy());
     // create users
     self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1, true);
     self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, true);
     self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, true);
     self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, true);
     // create group and assign users
     \OC_Group::createGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
 }
Ejemplo n.º 4
0
 public function setUp()
 {
     OC_User::clearBackends();
     OC_User::useBackend('dummy');
     $this->user1 = uniqid('user1_');
     $this->user2 = uniqid('user2_');
     $this->user3 = uniqid('user3_');
     $this->user4 = uniqid('user4_');
     OC_User::createUser($this->user1, 'pass');
     OC_User::createUser($this->user2, 'pass');
     OC_User::createUser($this->user3, 'pass');
     OC_User::createUser($this->user4, 'pass');
     OC_User::setUserId($this->user1);
     OC_Group::clearBackends();
     OC_Group::useBackend(new OC_Group_Dummy());
     $this->group1 = uniqid('group_');
     $this->group2 = uniqid('group_');
     OC_Group::createGroup($this->group1);
     OC_Group::createGroup($this->group2);
     OC_Group::addToGroup($this->user1, $this->group1);
     OC_Group::addToGroup($this->user2, $this->group1);
     OC_Group::addToGroup($this->user3, $this->group1);
     OC_Group::addToGroup($this->user2, $this->group2);
     OC_Group::addToGroup($this->user4, $this->group2);
     OCP\Share::registerBackend('test', 'Test_Share_Backend');
     OC_Hook::clear('OCP\\Share');
     OC::registerShareHooks();
     $this->resharing = OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes');
     OC_Appconfig::setValue('core', 'shareapi_allow_resharing', 'yes');
     // 20 Minutes in the past, 20 minutes in the future.
     $now = time();
     $dateFormat = 'Y-m-d H:i:s';
     $this->dateInPast = date($dateFormat, $now - 20 * 60);
     $this->dateInFuture = date($dateFormat, $now + 20 * 60);
 }
Ejemplo n.º 5
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // note: not using a data provider because these
     // files all need to coexist to make sure the
     // share keys are found properly (pattern matching)
     self::$testFiles = array('t est.txt', 't est_.txt', 't est.doc.txt', 't est(.*).txt', 'multiple.dots.can.happen.too.txt', 't est.' . self::TEST_ENCRYPTION_HOOKS_USER1 . '.txt', 't est_.' . self::TEST_ENCRYPTION_HOOKS_USER1 . '.shareKey.txt', 'who would upload their.shareKey', 'user ones file.txt', 'user ones file.txt.backup', '.t est.txt');
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     \OC_Hook::clear('OC_Filesystem');
     \OC_Hook::clear('OC_User');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     // Filesystem related hooks
     \OCA\Encryption\Helper::registerFilesystemHooks();
     // Sharing related hooks
     \OCA\Encryption\Helper::registerShareHooks();
     // clear and register proxies
     \OC_FileProxy::clearProxies();
     \OC_FileProxy::register(new OCA\Encryption\Proxy());
     // create test user
     self::loginHelper(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1, true);
     self::loginHelper(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2, true);
 }
Ejemplo n.º 6
0
 public function setUp()
 {
     OC_User::clearBackends();
     OC_User::useBackend('dummy');
     $this->user1 = uniqid('user1_');
     $this->user2 = uniqid('user2_');
     $this->user3 = uniqid('user3_');
     $this->user4 = uniqid('user4_');
     OC_User::createUser($this->user1, 'pass');
     OC_User::createUser($this->user2, 'pass');
     OC_User::createUser($this->user3, 'pass');
     OC_User::createUser($this->user4, 'pass');
     OC_User::setUserId($this->user1);
     OC_Group::clearBackends();
     OC_Group::useBackend(new OC_Group_Dummy());
     $this->group1 = uniqid('group_');
     $this->group2 = uniqid('group_');
     OC_Group::createGroup($this->group1);
     OC_Group::createGroup($this->group2);
     OC_Group::addToGroup($this->user1, $this->group1);
     OC_Group::addToGroup($this->user2, $this->group1);
     OC_Group::addToGroup($this->user3, $this->group1);
     OC_Group::addToGroup($this->user2, $this->group2);
     OC_Group::addToGroup($this->user4, $this->group2);
     OCP\Share::registerBackend('test', 'Test_Share_Backend');
     OC_Hook::clear('OCP\\Share');
     OC::registerShareHooks();
 }
Ejemplo n.º 7
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $appManager = \OC::$server->getAppManager();
     self::$trashBinStatus = $appManager->isEnabledForUser('files_trashbin');
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     $application = new \OCA\Files_Sharing\AppInfo\Application();
     $application->registerMountProviders();
     //disable encryption
     \OC_App::disable('encryption');
     $config = \OC::$server->getConfig();
     //configure trashbin
     self::$rememberRetentionObligation = $config->getSystemValue('trashbin_retention_obligation', Files_Trashbin\Expiration::DEFAULT_RETENTION_OBLIGATION);
     $config->setSystemValue('trashbin_retention_obligation', 'auto, 2');
     // register hooks
     Files_Trashbin\Trashbin::registerHooks();
     // create test user
     self::loginHelper(self::TEST_TRASHBIN_USER2, true);
     self::loginHelper(self::TEST_TRASHBIN_USER1, true);
 }
Ejemplo n.º 8
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     \OC_Hook::clear('OC_Filesystem');
     \OC_Hook::clear('OC_User');
     \OC_Hook::clear('OCP\\Share');
     // trashbin hooks
     \OCA\Files_Trashbin\Trashbin::registerHooks();
     // Filesystem related hooks
     \OCA\Encryption\Helper::registerFilesystemHooks();
     // register share hooks
     \OC::registerShareHooks();
     \OCA\Files_Sharing\Helper::registerHooks();
     // Sharing related hooks
     \OCA\Encryption\Helper::registerShareHooks();
     // Filesystem related hooks
     \OCA\Encryption\Helper::registerFilesystemHooks();
     // clear and register hooks
     \OC_FileProxy::clearProxies();
     \OC_FileProxy::register(new OCA\Files\Share\Proxy());
     \OC_FileProxy::register(new OCA\Encryption\Proxy());
     // create test user
     self::loginHelper(self::TEST_ENCRYPTION_TRASHBIN_USER2, true);
     self::loginHelper(self::TEST_ENCRYPTION_TRASHBIN_USER1, true);
 }
Ejemplo n.º 9
0
 public static function setUpBeforeClass()
 {
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // enable resharing
     \OC_Appconfig::setValue('core', 'shareapi_allow_resharing', 'yes');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     // Sharing related hooks
     \OCA\Encryption\Helper::registerShareHooks();
     // Filesystem related hooks
     \OCA\Encryption\Helper::registerFilesystemHooks();
     // clear and register hooks
     \OC_FileProxy::clearProxies();
     \OC_FileProxy::register(new OCA\Encryption\Proxy());
     // create users
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1, true);
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, true);
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, true);
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, true);
     // create group and assign users
     \OC_Group::createGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
 }
Ejemplo n.º 10
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // reset backend
     \OC_User::clearBackends();
     \OC_Group::clearBackends();
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     // create users
     $backend = new \OC_User_Dummy();
     \OC_User::useBackend($backend);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER1);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER2);
     $backend->createUser(self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER3);
     // create group
     $groupBackend = new \OC_Group_Dummy();
     $groupBackend->createGroup(self::TEST_FILES_SHARING_API_GROUP1);
     $groupBackend->createGroup('group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER1, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER3, 'group');
     $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_GROUP1);
     \OC_Group::useBackend($groupBackend);
 }
Ejemplo n.º 11
0
 public static function setUpBeforeClass()
 {
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     \OCA\Files_Versions\Hooks::connectHooks();
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     // create test user
     self::loginHelper(self::TEST_VERSIONS_USER2, true);
     self::loginHelper(self::TEST_VERSIONS_USER, true);
 }
Ejemplo n.º 12
0
 protected function setUp()
 {
     parent::setUp();
     // clear hooks
     \OC_Hook::clear();
     \OC::registerShareHooks();
     \OCA\Files_Versions\Hooks::connectHooks();
     self::loginHelper(self::TEST_VERSIONS_USER);
     $this->rootView = new \OC\Files\View();
     if (!$this->rootView->file_exists(self::USERS_VERSIONS_ROOT)) {
         $this->rootView->mkdir(self::USERS_VERSIONS_ROOT);
     }
 }
Ejemplo n.º 13
0
 public static function setUpBeforeClass()
 {
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     // create users
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1, true);
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2, true);
     self::loginHelper(self::TEST_FILES_SHARING_API_USER3, true);
 }
Ejemplo n.º 14
0
 protected function setup()
 {
     parent::setUp();
     $this->connection = \OC::$server->getDatabaseConnection();
     // clear occasional leftover shares from other tests
     $this->connection->executeUpdate('DELETE FROM `*PREFIX*share`');
     $this->user1 = $this->getUniqueID('user1_');
     $this->user2 = $this->getUniqueID('user2_');
     $userManager = \OC::$server->getUserManager();
     $userManager->createUser($this->user1, 'pass');
     $userManager->createUser($this->user2, 'pass');
     \OC::registerShareHooks();
     $this->job = new ExpireSharesJob();
 }
Ejemplo n.º 15
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     \OCA\Files_Encryption\Helper::registerFilesystemHooks();
     \OCA\Files_Encryption\Helper::registerUserHooks();
     \OCA\Files_Encryption\Helper::registerShareHooks();
     \OC::registerShareHooks();
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     // clear and register hooks
     \OC_FileProxy::clearProxies();
     \OC_FileProxy::register(new \OCA\Files_Encryption\Proxy());
 }
Ejemplo n.º 16
0
 protected function setUp()
 {
     parent::setUp();
     \OC_User::clearBackends();
     \OC_User::useBackend('dummy');
     $this->user1 = $this->getUniqueID('user1_');
     $this->user2 = $this->getUniqueID('user2_');
     $this->user3 = $this->getUniqueID('user3_');
     $this->user4 = $this->getUniqueID('user4_');
     $this->user5 = $this->getUniqueID('user5_');
     $this->user6 = $this->getUniqueID('user6_');
     $this->groupAndUser = $this->getUniqueID('groupAndUser_');
     \OC::$server->getUserManager()->createUser($this->user1, 'pass');
     \OC::$server->getUserManager()->createUser($this->user2, 'pass');
     \OC::$server->getUserManager()->createUser($this->user3, 'pass');
     \OC::$server->getUserManager()->createUser($this->user4, 'pass');
     \OC::$server->getUserManager()->createUser($this->user5, 'pass');
     \OC::$server->getUserManager()->createUser($this->user6, 'pass');
     // no group
     \OC::$server->getUserManager()->createUser($this->groupAndUser, 'pass');
     \OC_User::setUserId($this->user1);
     \OC_Group::clearBackends();
     \OC_Group::useBackend(new \Test\Util\Group\Dummy());
     $this->group1 = $this->getUniqueID('group1_');
     $this->group2 = $this->getUniqueID('group2_');
     \OC_Group::createGroup($this->group1);
     \OC_Group::createGroup($this->group2);
     \OC_Group::createGroup($this->groupAndUser);
     \OC_Group::addToGroup($this->user1, $this->group1);
     \OC_Group::addToGroup($this->user2, $this->group1);
     \OC_Group::addToGroup($this->user3, $this->group1);
     \OC_Group::addToGroup($this->user2, $this->group2);
     \OC_Group::addToGroup($this->user4, $this->group2);
     \OC_Group::addToGroup($this->user2, $this->groupAndUser);
     \OC_Group::addToGroup($this->user3, $this->groupAndUser);
     \OCP\Share::registerBackend('test', 'Test\\Share\\Backend');
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     $this->resharing = \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_resharing', 'yes');
     \OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', 'yes');
     // 20 Minutes in the past, 20 minutes in the future.
     $now = time();
     $dateFormat = 'Y-m-d H:i:s';
     $this->dateInPast = date($dateFormat, $now - 20 * 60);
     $this->dateInFuture = date($dateFormat, $now + 20 * 60);
 }
Ejemplo n.º 17
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // enable resharing
     \OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', 'yes');
     // register share hooks
     \OC::registerShareHooks();
     \OCA\Files_Sharing\Helper::registerHooks();
     // clear and register hooks
     \OC_FileProxy::register(new \OCA\Files\Share\Proxy());
     // create users
     self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER1, true);
     self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER2, true);
     self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER3, true);
     self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER4, true);
     // create group and assign users
     \OC_Group::createGroup(self::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(self::TEST_ENCRYPTION_SHARE_USER3, self::TEST_ENCRYPTION_SHARE_GROUP1);
     \OC_Group::addToGroup(self::TEST_ENCRYPTION_SHARE_USER4, self::TEST_ENCRYPTION_SHARE_GROUP1);
 }
Ejemplo n.º 18
0
 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');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     // create users
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1, true);
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2, true);
     self::loginHelper(self::TEST_FILES_SHARING_API_USER3, true);
     // create group
     \OC_Group::createGroup(self::TEST_FILES_SHARING_API_GROUP1);
     \OC_Group::addToGroup(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_GROUP1);
 }
Ejemplo n.º 19
0
 public static function setUpBeforeClass()
 {
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     \OC_Hook::clear('OC_Filesystem');
     \OC_Hook::clear('OC_User');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     // Filesystem related hooks
     \OCA\Encryption\Helper::registerFilesystemHooks();
     // Sharing related hooks
     \OCA\Encryption\Helper::registerShareHooks();
     // clear and register proxies
     \OC_FileProxy::clearProxies();
     \OC_FileProxy::register(new OCA\Encryption\Proxy());
     // create test user
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1, true);
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2, true);
 }
Ejemplo n.º 20
0
 protected function setUp()
 {
     parent::setUp();
     $config = \OC::$server->getConfig();
     $mockConfig = $this->getMock('\\OCP\\IConfig');
     $mockConfig->expects($this->any())->method('getSystemValue')->will($this->returnCallback(function ($key, $default) use($config) {
         if ($key === 'filesystem_check_changes') {
             return \OC\Files\Cache\Watcher::CHECK_ONCE;
         } else {
             return $config->getSystemValue($key, $default);
         }
     }));
     $this->overwriteService('AllConfig', $mockConfig);
     // clear hooks
     \OC_Hook::clear();
     \OC::registerShareHooks();
     \OCA\Files_Versions\Hooks::connectHooks();
     self::loginHelper(self::TEST_VERSIONS_USER);
     $this->rootView = new \OC\Files\View();
     if (!$this->rootView->file_exists(self::USERS_VERSIONS_ROOT)) {
         $this->rootView->mkdir(self::USERS_VERSIONS_ROOT);
     }
 }
Ejemplo n.º 21
0
 public static function setUpBeforeClass()
 {
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
     //disable encryption
     self::$encryptionStatus = \OC_App::isEnabled('files_encryption');
     \OC_App::disable('files_encryption');
     //configure trashbin
     self::$rememberRetentionObligation = \OC_Config::getValue('trashbin_retention_obligation', Files_Trashbin\Trashbin::DEFAULT_RETENTION_OBLIGATION);
     \OC_Config::setValue('trashbin_retention_obligation', 2);
     self::$rememberAutoExpire = \OC_Config::getValue('trashbin_auto_expire', true);
     \OC_Config::setValue('trashbin_auto_expire', true);
     // register hooks
     Files_Trashbin\Trashbin::registerHooks();
     // create test user
     self::loginHelper(self::TEST_TRASHBIN_USER2, true);
     self::loginHelper(self::TEST_TRASHBIN_USER1, true);
 }