protected function setUp() { parent::setUp(); $this->tmpDir = \OC_Helper::tmpFolder(); $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); $this->instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 10000000)); }
public function setUp() { parent::setUp(); $this->sourceStorage = new \OC\Files\Storage\Temporary(array()); $this->sourceStorage->mkdir('foo'); $this->instance = new \OC\Files\Storage\Wrapper\Jail(array('storage' => $this->sourceStorage, 'root' => 'foo')); }
protected function setUp() { parent::setUp(); $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); $this->instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 10000000)); }
protected function setUp() { parent::setUp(); $mockModule = $this->buildMockModule(); $this->encryptionManager = $this->getMockBuilder('\\OC\\Encryption\\Manager')->disableOriginalConstructor()->setMethods(['getEncryptionModule', 'isEnabled'])->getMock(); $this->encryptionManager->expects($this->any())->method('getEncryptionModule')->willReturn($mockModule); $this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock(); $this->groupManager = $this->getMockBuilder('\\OC\\Group\\Manager')->disableOriginalConstructor()->getMock(); $this->util = $this->getMock('\\OC\\Encryption\\Util', ['getUidAndFilename', 'isFile', 'isExcluded'], [new View(), new \OC\User\Manager(), $this->groupManager, $this->config]); $this->util->expects($this->any())->method('getUidAndFilename')->willReturnCallback(function ($path) { return ['user1', $path]; }); $this->file = $this->getMockBuilder('\\OC\\Encryption\\File')->disableOriginalConstructor()->setMethods(['getAccessList'])->getMock(); $this->file->expects($this->any())->method('getAccessList')->willReturn([]); $this->logger = $this->getMock('\\OC\\Log'); $this->sourceStorage = new Temporary(array()); $this->keyStore = $this->getMockBuilder('\\OC\\Encryption\\Keys\\Storage')->disableOriginalConstructor()->getMock(); $this->update = $this->getMockBuilder('\\OC\\Encryption\\Update')->disableOriginalConstructor()->getMock(); $this->mount = $this->getMockBuilder('\\OC\\Files\\Mount\\MountPoint')->disableOriginalConstructor()->setMethods(['getOption'])->getMock(); $this->mount->expects($this->any())->method('getOption')->willReturn(true); $this->cache = $this->getMockBuilder('\\OC\\Files\\Cache\\Cache')->disableOriginalConstructor()->getMock(); $this->cache->expects($this->any())->method('get')->willReturnCallback(function ($path) { return ['encrypted' => false, 'path' => $path]; }); $this->mountManager = $this->getMockBuilder('\\OC\\Files\\Mount\\Manager')->disableOriginalConstructor()->getMock(); $this->instance = $this->getMockBuilder('\\OC\\Files\\Storage\\Wrapper\\Encryption')->setConstructorArgs([['storage' => $this->sourceStorage, 'root' => 'foo', 'mountPoint' => '/', 'mount' => $this->mount], $this->encryptionManager, $this->util, $this->logger, $this->file, null, $this->keyStore, $this->update, $this->mountManager])->setMethods(['getMetaData', 'getCache', 'getEncryptionModule'])->getMock(); $this->instance->expects($this->any())->method('getMetaData')->willReturnCallback(function ($path) { return ['encrypted' => true, 'size' => $this->dummySize, 'path' => $path]; }); $this->instance->expects($this->any())->method('getCache')->willReturn($this->cache); $this->instance->expects($this->any())->method('getEncryptionModule')->willReturn($mockModule); }
protected function setUp() { parent::setUp(); if (!getenv('RUN_OBJECTSTORE_TESTS')) { $this->markTestSkipped('objectstore tests are unreliable in some environments'); } \OC_App::disable('files_sharing'); \OC_App::disable('files_versions'); // reset backend \OC_User::clearBackends(); \OC_User::useBackend('database'); // create users $users = array('test'); foreach ($users as $userName) { \OC_User::deleteUser($userName); \OC_User::createUser($userName, $userName); } // main test user $userName = '******'; \OC_Util::tearDownFS(); \OC_User::setUserId(''); \OC\Files\Filesystem::tearDown(); \OC_User::setUserId('test'); $testContainer = 'oc-test-container-' . substr(md5(rand()), 0, 7); $params = array('username' => 'facebook100000330192569', 'password' => 'Dbdj1sXnRSHxIGc4', 'container' => $testContainer, 'autocreate' => true, 'region' => 'RegionOne', 'url' => 'http://8.21.28.222:5000/v2.0', 'tenantName' => 'facebook100000330192569', 'serviceName' => 'swift', 'user' => \OC_User::getManager()->get($userName)); $this->objectStorage = new ObjectStoreToTest($params); $params['objectstore'] = $this->objectStorage; $this->instance = new ObjectStoreStorage($params); }
protected function setUp() { parent::setUp(); if (!getenv('RUN_OBJECTSTORE_TESTS')) { $this->markTestSkipped('objectstore tests are unreliable in some environments'); } // reset backend \OC_User::clearBackends(); \OC_User::useBackend('database'); // create users $users = array('test'); foreach ($users as $userName) { \OC_User::deleteUser($userName); \OC_User::createUser($userName, $userName); } // main test user \OC_Util::tearDownFS(); \OC_User::setUserId(''); \OC\Files\Filesystem::tearDown(); \OC_User::setUserId('test'); $config = \OC::$server->getConfig()->getSystemValue('objectstore'); $this->objectStorage = new ObjectStoreToTest($config['arguments']); $config['objectstore'] = $this->objectStorage; $this->instance = new ObjectStoreStorage($config); }
protected function setUp() { parent::setUp(); $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->userId = $this->getUniqueID('user_'); $this->user = new DummyUser($this->userId, $this->tmpDir); $this->instance = new \OC\Files\Storage\Home(array('user' => $this->user)); }
protected function setUp() { parent::setUp(); $this->tmpDir = \OC_Helper::tmpFolder(); $this->userId = $this->getUniqueID('user_'); $this->user = new DummyUser($this->userId, $this->tmpDir); $this->instance = new \OC\Files\Storage\Home(array('user' => $this->user)); }
protected function setUp() { parent::setUp(); $this->config = (include 'files_external/tests/config.amazons3.php'); if (!is_array($this->config) or !$this->config['run']) { $this->markTestSkipped('AmazonS3 backend not configured'); } $this->instance = new AmazonS3($this->config); }
protected function setUp() { parent::setUp(); $this->config = (include 'files_external/tests/config.swift.php'); if (!is_array($this->config) or !$this->config['run']) { $this->markTestSkipped('OpenStack Object Storage backend not configured'); } $this->instance = new Swift($this->config); }
protected function setUp() { parent::setUp(); $this->config = (include 'files_external/tests/config.php'); if (!is_array($this->config) || !isset($this->config['google']) || !$this->config['google']['run']) { $this->markTestSkipped('Google Drive backend not configured'); } $this->instance = new Google($this->config['google']); }
protected function setUp() { parent::setUp(); $id = $this->getUniqueID(); $this->config = (include 'files_external/tests/config.php'); if (!is_array($this->config) or !isset($this->config['dropbox']) or !$this->config['dropbox']['run']) { $this->markTestSkipped('Dropbox backend not configured'); } $this->config['dropbox']['root'] .= '/' . $id; //make sure we have an new empty folder to work in $this->instance = new Dropbox($this->config['dropbox']); }
protected function setUp() { parent::setUp(); $id = $this->getUniqueID(); $this->config = (include 'files_external/tests/config.php'); if (!is_array($this->config) or !isset($this->config['sftp_key']) or !$this->config['sftp_key']['run']) { $this->markTestSkipped('SFTP with key backend not configured'); } // Make sure we have an new empty folder to work in $this->config['sftp_key']['root'] .= '/' . $id; $this->instance = new SFTP_Key($this->config['sftp_key']); $this->instance->mkdir('/'); }
protected function setUp() { parent::setUp(); $id = $this->getUniqueID(); $config = (include 'files_external/tests/config.webdav.php'); if (!is_array($config) or !$config['run']) { $this->markTestSkipped('WebDAV backend not configured'); } if (isset($config['wait'])) { $this->waitDelay = $config['wait']; } $config['root'] .= '/' . $id; //make sure we have an new empty folder to work in $this->instance = new DAV($config); $this->instance->mkdir('/'); }
protected function setUp() { parent::setUp(); $id = $this->getUniqueID(); $config = (include 'files_external/tests/config.smb.php'); if (!is_array($config) or !$config['run']) { $this->markTestSkipped('Samba backend not configured'); } if (substr($config['root'], -1, 1) != '/') { $config['root'] .= '/'; } $config['root'] .= $id; //make sure we have an new empty folder to work in $this->instance = new SMB($config); $this->instance->mkdir('/'); }
public function setUp() { parent::setUp(); $mockModule = $this->buildMockModule(); $encryptionManager = $this->getMockBuilder('\\OC\\Encryption\\Manager')->disableOriginalConstructor()->setMethods(['getDefaultEncryptionModule', 'getEncryptionModule', 'isEnabled'])->getMock(); $encryptionManager->expects($this->any())->method('getDefaultEncryptionModule')->willReturn($mockModule); $encryptionManager->expects($this->any())->method('getEncryptionModule')->willReturn($mockModule); $encryptionManager->expects($this->any())->method('isEnabled')->willReturn(true); $config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock(); $util = $this->getMock('\\OC\\Encryption\\Util', ['getUidAndFilename'], [new View(), new \OC\User\Manager(), $config]); $util->expects($this->any())->method('getUidAndFilename')->willReturnCallback(function ($path) { return ['user1', $path]; }); $file = $this->getMockBuilder('\\OC\\Encryption\\File')->disableOriginalConstructor()->setMethods(['getAccessList'])->getMock(); $file->expects($this->any())->method('getAccessList')->willReturn([]); $logger = $this->getMock('\\OC\\Log'); $this->sourceStorage = new Temporary(array()); $keyStore = $this->getMockBuilder('\\OC\\Encryption\\Keys\\Storage')->disableOriginalConstructor()->getMock(); $mount = $this->getMockBuilder('\\OC\\Files\\Mount\\MountPoint')->disableOriginalConstructor()->setMethods(['getOption'])->getMock(); $mount->expects($this->any())->method('getOption')->willReturn(true); $this->instance = new EncryptionWrapper(['storage' => $this->sourceStorage, 'root' => 'foo', 'mountPoint' => '/', 'mount' => $mount], $encryptionManager, $util, $logger, $file, null, $keyStore); }
protected function setUp() { parent::setUp(); $this->instance = new CopyDirectoryStorage([]); }
public function setUp() { parent::setUp(); $this->sourceStorage = new \OC\Files\Storage\Temporary([]); $this->instance = new \OC\Files\Storage\Wrapper\Encoding(['storage' => $this->sourceStorage]); }
public function setUp() { parent::setUp(); $this->sourceStorage = new \OC\Files\Storage\Temporary(array()); $this->instance = $this->getMaskedStorage(Constants::PERMISSION_ALL); }