protected function tearDown() { if ($this->instance) { $this->instance->rmdir('/'); } parent::tearDown(); }
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 tearDown() { if ($this->instance) { \OCP\Files::rmdirr($this->instance->constructUrl('')); } parent::tearDown(); }
protected function tearDown() { if (is_null($this->instance)) { return; } $this->objectStorage->deleteContainer(true); $this->instance->getCache()->clear(); parent::tearDown(); }
protected function tearDown() { if (is_null($this->instance)) { return; } $this->objectStorage->deleteContainer(true); $this->instance->getCache()->clear(); $users = array('test'); foreach ($users as $userName) { \OC_User::deleteUser($userName); } parent::tearDown(); }
public function tearDown() { // test that nothing outside our jail is touched $contents = array(); $dh = $this->sourceStorage->opendir(''); while ($file = readdir($dh)) { if ($file !== '.' and $file !== '..') { $contents[] = $file; } } $this->assertEquals(array('foo'), $contents); $this->sourceStorage->cleanUp(); parent::tearDown(); }
protected function tearDown() { if (is_null($this->instance)) { return; } $this->objectStorage->deleteContainer(true); $this->instance->getCache()->clear(); $users = array('test'); foreach ($users as $userName) { $user = \OC::$server->getUserManager()->get($userName); if ($user !== null) { $user->delete(); } } parent::tearDown(); }
protected function tearDown() { if ($this->instance) { try { $connection = $this->instance->getConnection(); $container = $connection->getContainer($this->config['bucket']); $objects = $container->objectList(); while ($object = $objects->next()) { $object->setName(str_replace('#', '%23', $object->getName())); $object->delete(); } $container->delete(); } catch (\Guzzle\Http\Exception\ClientErrorResponseException $e) { // container didn't exist, so we don't need to delete it } } parent::tearDown(); }
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 tearDown() { \OC_Helper::rmdirr($this->tmpDir); parent::tearDown(); }
public function tearDown() { $this->sourceStorage->cleanUp(); parent::tearDown(); }
public function copyAndMoveProvider() { $a = parent::copyAndMoveProvider(); $a[] = [self::NFD_NAME . '.txt', self::NFC_NAME . '-renamed.txt']; return $a; }
protected function setUp() { parent::setUp(); $this->instance = new CopyDirectoryStorage([]); }