diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-30 13:23:10 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-07 13:30:28 +0200 |
commit | a905f641b3e619838c945caa29a1604f5b3ab8ba (patch) | |
tree | 1c7e853b87b6fde1fc14f16a38cdf12a89f51d18 /tests | |
parent | 3e6eb28ee39d366bccfb8a1c96839f4b05c9da6e (diff) | |
download | nextcloud-server-a905f641b3e619838c945caa29a1604f5b3ab8ba.tar.gz nextcloud-server-a905f641b3e619838c945caa29a1604f5b3ab8ba.zip |
various fixes & start to unit test the encryption storage wrapper
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/storage/wrapper/encryption.php | 50 | ||||
-rw-r--r-- | tests/lib/files/storage/wrapper/jail.php | 4 |
2 files changed, 50 insertions, 4 deletions
diff --git a/tests/lib/files/storage/wrapper/encryption.php b/tests/lib/files/storage/wrapper/encryption.php new file mode 100644 index 00000000000..b8d4e962c54 --- /dev/null +++ b/tests/lib/files/storage/wrapper/encryption.php @@ -0,0 +1,50 @@ +<?php + +namespace Test\Files\Storage\Wrapper; + +use OC\Files\View; +use OCA\Encryption_Dummy\DummyModule; + +class Encryption extends \Test\Files\Storage\Storage { + + /** + * @var \OC\Files\Storage\Temporary + */ + private $sourceStorage; + + public function setUp() { + + parent::setUp(); + + $encryptionManager = $this->getMockBuilder('\OC\Encryption\Manager') + ->disableOriginalConstructor() + ->setMethods(['getDefaultEncryptionModule', 'getEncryptionModule']) + ->getMock(); + $encryptionManager->expects($this->any()) + ->method('getDefaultEncryptionModule') + ->willReturn(new DummyModule()); + + $util = new \OC\Encryption\Util(new View(), new \OC\User\Manager()); + + $logger = $this->getMock('\OC\Log'); + + $this->sourceStorage = new \OC\Files\Storage\Temporary(array()); + $this->instance = new \OC\Files\Storage\Wrapper\Encryption([ + 'storage' => $this->sourceStorage, + 'root' => 'foo', + 'mountPoint' => '/' + ], + $encryptionManager, $util, $logger + ); + } + +// public function testMkDirRooted() { +// $this->instance->mkdir('bar'); +// $this->assertTrue($this->sourceStorage->is_dir('foo/bar')); +// } +// +// public function testFilePutContentsRooted() { +// $this->instance->file_put_contents('bar', 'asd'); +// $this->assertEquals('asd', $this->sourceStorage->file_get_contents('foo/bar')); +// } +} diff --git a/tests/lib/files/storage/wrapper/jail.php b/tests/lib/files/storage/wrapper/jail.php index 270ce750ecf..a7bd684df44 100644 --- a/tests/lib/files/storage/wrapper/jail.php +++ b/tests/lib/files/storage/wrapper/jail.php @@ -9,10 +9,6 @@ namespace Test\Files\Storage\Wrapper; class Jail extends \Test\Files\Storage\Storage { - /** - * @var string tmpDir - */ - private $tmpDir; /** * @var \OC\Files\Storage\Temporary |