Beispiel #1
0
 protected function tearDown()
 {
     if ($this->instance) {
         $this->instance->rmdir('/');
     }
     parent::tearDown();
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
 protected function tearDown()
 {
     if ($this->instance) {
         \OCP\Files::rmdirr($this->instance->constructUrl(''));
     }
     parent::tearDown();
 }
Beispiel #4
0
 protected function tearDown()
 {
     if (is_null($this->instance)) {
         return;
     }
     $this->objectStorage->deleteContainer(true);
     $this->instance->getCache()->clear();
     parent::tearDown();
 }
Beispiel #5
0
 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();
 }
Beispiel #6
0
	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();
	}
Beispiel #7
0
 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();
 }
Beispiel #8
0
 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();
 }
Beispiel #9
0
 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);
 }
Beispiel #10
0
	protected function tearDown() {
		\OC_Helper::rmdirr($this->tmpDir);
		parent::tearDown();
	}
 public function tearDown()
 {
     $this->sourceStorage->cleanUp();
     parent::tearDown();
 }
Beispiel #12
0
 public function copyAndMoveProvider()
 {
     $a = parent::copyAndMoveProvider();
     $a[] = [self::NFD_NAME . '.txt', self::NFC_NAME . '-renamed.txt'];
     return $a;
 }
Beispiel #13
0
	protected function setUp() {
		parent::setUp();
		$this->instance = new CopyDirectoryStorage([]);
	}