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); }
public function setUp() { //clear all proxies and hooks so we can do clean testing \OC_FileProxy::clearProxies(); \OC_Hook::clear('OC_Filesystem'); //disabled atm //enable only the encryption hook if needed //if(OC_App::isEnabled('files_encryption')) { // OC_FileProxy::register(new OC_FileProxy_Encryption()); //} //set up temporary storage \OC\Files\Filesystem::clearMounts(); $storage = new \OC\Files\Storage\Temporary(array()); \OC\Files\Filesystem::mount($storage, array(), '/'); $datadir = str_replace('local::', '', $storage->getId()); $this->datadir = \OC_Config::getValue('cachedirectory', \OC::$SERVERROOT . '/data/cache'); \OC_Config::setValue('cachedirectory', $datadir); \OC_User::clearBackends(); \OC_User::useBackend(new \OC_User_Dummy()); //login \OC_User::createUser('test', 'test'); $this->user = \OC_User::getUser(); \OC_User::setUserId('test'); //set up the users dir $rootView = new \OC\Files\View(''); $rootView->mkdir('/test'); $this->instance = new \OC\Cache\File(); }
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); }
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); }
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); }
public function setUp() { // remember files_encryption state $this->stateFilesEncryption = \OC_App::isEnabled('files_encryption'); // we want to tests with the encryption app disabled \OC_App::disable('files_encryption'); $this->storage = new \OC\Files\Storage\Temporary(array()); $textData = "dummy file data\n"; $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png'); $this->storage->mkdir('folder'); $this->storage->file_put_contents('foo.txt', $textData); $this->storage->file_put_contents('foo.png', $imgData); $this->storage->file_put_contents('folder/bar.txt', $textData); $this->storage->file_put_contents('folder/bar2.txt', $textData); $this->scanner = $this->storage->getScanner(); $this->scanner->scan(''); $this->cache = $this->storage->getCache(); \OC\Files\Filesystem::tearDown(); if (!self::$user) { self::$user = uniqid(); } \OC_User::createUser(self::$user, 'password'); \OC_User::setUserId(self::$user); \OC\Files\Filesystem::init(self::$user, '/' . self::$user . '/files'); Filesystem::clearMounts(); Filesystem::mount($this->storage, array(), '/' . self::$user . '/files'); \OC_Hook::clear('OC_Filesystem'); }
protected function tearDown() { \OC_Hook::clear('OC_Filesystem', 'post_write'); \OC_Hook::clear('OC_Filesystem', 'post_delete'); \OC_Hook::clear('OC_Filesystem', 'post_rename'); parent::tearDown(); }
protected function setUp() { parent::setUp(); $this->storage = new \OC\Files\Storage\Temporary(array()); $textData = "dummy file data\n"; $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png'); $this->storage->mkdir('folder'); $this->storage->file_put_contents('foo.txt', $textData); $this->storage->file_put_contents('foo.png', $imgData); $this->storage->file_put_contents('folder/bar.txt', $textData); $this->storage->file_put_contents('folder/bar2.txt', $textData); $this->scanner = $this->storage->getScanner(); $this->scanner->scan(''); $this->cache = $this->storage->getCache(); if (!self::$user) { self::$user = $this->getUniqueID(); } \OC_User::createUser(self::$user, 'password'); $this->loginAsUser(self::$user); Filesystem::init(self::$user, '/' . self::$user . '/files'); Filesystem::clearMounts(); Filesystem::mount($this->storage, array(), '/' . self::$user . '/files'); \OC_Hook::clear('OC_Filesystem'); }
public static function 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 \Test_Encryption_Util::loginHelper(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1, true); \Test_Encryption_Util::loginHelper(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2, true); }
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(); }
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); }
protected function setUp() { parent::setUp(); $this->emitter = new DummyLegacyEmitter(); self::$emitted = false; \OC_Hook::clear('Test', 'test'); }
protected function setUp() { parent::setUp(); //clear all proxies and hooks so we can do clean testing \OC_Hook::clear('OC_Filesystem'); //set up temporary storage $this->storage = \OC\Files\Filesystem::getStorage('/'); \OC\Files\Filesystem::clearMounts(); $storage = new \OC\Files\Storage\Temporary(array()); \OC\Files\Filesystem::mount($storage, array(), '/'); $datadir = str_replace('local::', '', $storage->getId()); $config = \OC::$server->getConfig(); $this->datadir = $config->getSystemValue('cachedirectory', \OC::$SERVERROOT . '/data/cache'); $config->setSystemValue('cachedirectory', $datadir); \OC_User::clearBackends(); \OC_User::useBackend(new \Test\Util\User\Dummy()); //login \OC_User::createUser('test', 'test'); $this->user = \OC_User::getUser(); \OC_User::setUserId('test'); //set up the users dir $this->rootView = new \OC\Files\View(''); $this->rootView->mkdir('/test'); $this->instance = new \OC\Cache\File(); // forces creation of cache folder for subsequent tests $this->instance->set('hack', 'hack'); }
protected function tearDown() { \OC_Hook::clear('OC_Filesystem', 'post_write'); \OC_Hook::clear('OC_Filesystem', 'post_delete'); \OC_Hook::clear('OC_Filesystem', 'post_rename'); \OC_Hook::clear('OCP\\Share', 'post_update_permissions'); parent::tearDown(); }
public static function tearDownAfterClass() { // cleanup test user \OC_User::deleteUser(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER1); \OC_User::deleteUser(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER2); \OC_Hook::clear(); \OC_FileProxy::clearProxies(); }
protected function tearDown() { \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin'); $this->logout(); \OC_User::deleteUser($this->user); \OC_Hook::clear(); parent::tearDown(); }
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/'); \OC_Hook::clear(); parent::tearDown(); }
public static function tearDownAfterClass() { \OC_Hook::clear(); \OC_FileProxy::clearProxies(); // Delete keys in /data/ $view = new \OC\Files\View('/'); $view->rmdir('public-keys'); $view->rmdir('owncloud_private_key'); }
public static function tearDownAfterClass() { \OC_Hook::clear(); \OC_FileProxy::clearProxies(); // Delete keys in /data/ $view = new \OC\Files\View('/'); $view->deleteAll('files_encryption'); parent::tearDownAfterClass(); }
public function setUp() { parent::setUp(); \OC_Hook::clear(); $this->user = $this->getUniqueID('user_'); $userManager = \OC::$server->getUserManager(); $userManager->createUser($this->user, 'pass'); $this->loginAsUser($this->user); }
public static function tearDownAfterClass() { // cleanup test user \OC_User::deleteUser(self::TEST_TRASHBIN_USER1); \OC_Config::setValue('trashbin_retention_obligation', self::$rememberRetentionObligation); \OC_Config::setValue('trashbin_auto_expire', self::$rememberAutoExpire); \OC_Hook::clear(); \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin'); parent::tearDownAfterClass(); }
public static function tearDownAfterClass() { // cleanup test user \OC_User::deleteUser(self::TEST_TRASHBIN_USER1); if (self::$encryptionStatus === true) { \OC_App::enable('files_encryption'); } \OC_Config::setValue('trashbin_retention_obligation', self::$rememberRetentionObligation); \OC_Config::setValue('trashbin_auto_expire', self::$rememberAutoExpire); \OC_Hook::clear(); }
protected function tearDown() { \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin'); $this->logout(); $user = \OC::$server->getUserManager()->get($this->user); if ($user !== null) { $user->delete(); } \OC_Hook::clear(); parent::tearDown(); }
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); }
public static function tearDownAfterClass() { // cleanup test user \OC_User::deleteUser(\Test_Encryption_Stream::TEST_ENCRYPTION_STREAM_USER1); \OC_Hook::clear(); \OC_FileProxy::clearProxies(); // Delete keys in /data/ $view = new \OC\Files\View('/'); $view->rmdir('public-keys'); $view->rmdir('owncloud_private_key'); }
public static function tearDownAfterClass() { // cleanup test user \OC_User::deleteUser(self::TEST_TRASHBIN_USER1); \OC::$server->getConfig()->setSystemValue('trashbin_retention_obligation', self::$rememberRetentionObligation); \OC_Hook::clear(); \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin'); if (self::$trashBinStatus) { \OC::$server->getAppManager()->enableApp('files_trashbin'); } parent::tearDownAfterClass(); }
protected function setUp() { parent::setUp(); \OC_Hook::clear('OC_Filesystem', 'setup'); \OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup'); \OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); $this->datadir = \OC_Config::getValue('datadirectory'); $this->tmpDir = \OC_Helper::tmpFolder(); \OC_Config::setValue('datadirectory', $this->tmpDir); $this->userBackend = new \OC_User_Dummy(); \OC_User::useBackend($this->userBackend); }
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); }
protected function setUp() { parent::setUp(); \OC_Hook::clear('OC_Filesystem', 'setup'); $application = new \OCA\Files_Sharing\AppInfo\Application(); $application->registerMountProviders(); \OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); $this->datadir = \OC_Config::getValue('datadirectory'); $this->tmpDir = \OC_Helper::tmpFolder(); \OC_Config::setValue('datadirectory', $this->tmpDir); $this->userBackend = new \Test\Util\User\Dummy(); \OC_User::useBackend($this->userBackend); }
public static function setUpBeforeClass() { // reset backend \OC_User::clearBackends(); \OC_User::useBackend('database'); // clear hooks and register encryption hooks \OC_Hook::clear(); \OCA\Encryption\Helper::registerFilesystemHooks(); \OCA\Encryption\Helper::registerUserHooks(); // clear and register proxies \OC_FileProxy::clearProxies(); \OC_FileProxy::register(new OCA\Encryption\Proxy()); // create test user \Test_Encryption_Util::loginHelper(\Test_Encryption_Crypt::TEST_ENCRYPTION_CRYPT_USER1, true); }