summaryrefslogtreecommitdiffstats
path: root/tests/lib/files/storage/wrapper/encryption.php
blob: b8d4e962c548d9087bb7f7e0025ceaabc7ee2b52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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'));
//	}
}