diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-06-07 17:40:38 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-06-07 17:40:38 +0200 |
commit | 31693d393749c94591dc0814cc502eac8d415e11 (patch) | |
tree | 14c9b3a51a58ea8863f38a68e7c237bc62cad24b /tests | |
parent | 2708ab09abf12321df97ed730a83c328d2b360fc (diff) | |
download | nextcloud-server-31693d393749c94591dc0814cc502eac8d415e11.tar.gz nextcloud-server-31693d393749c94591dc0814cc502eac8d415e11.zip |
add test cases for Mount
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/mount/mount.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/lib/files/mount/mount.php b/tests/lib/files/mount/mount.php new file mode 100644 index 00000000000..aa98db856f4 --- /dev/null +++ b/tests/lib/files/mount/mount.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace Test\Files\Mount; + + +use OC\Files\Storage\Loader; +use OC\Files\Storage\Wrapper; + +class Mount extends \PHPUnit_Framework_TestCase { + public function testFromStorageObject() { + $storage = $this->getMockBuilder('\OC\Files\Storage\Temporary') + ->disableOriginalConstructor() + ->getMock(); + $mount = new \OC\Files\Mount\Mount($storage, '/foo'); + $this->assertInstanceOf('\OC\Files\Storage\Temporary', $mount->getStorage()); + } + + public function testFromStorageClassname() { + $mount = new \OC\Files\Mount\Mount('\OC\Files\Storage\Temporary', '/foo'); + $this->assertInstanceOf('\OC\Files\Storage\Temporary', $mount->getStorage()); + } + + public function testWrapper() { + $test = $this; + $wrapper = function ($mountPoint, $storage) use (&$test) { + $test->assertEquals('/foo/', $mountPoint); + $test->assertInstanceOf('\OC\Files\Storage\Storage', $storage); + return new Wrapper(array('storage' => $storage)); + }; + + $loader = new Loader(); + $loader->addStorageWrapper($wrapper); + + $storage = $this->getMockBuilder('\OC\Files\Storage\Temporary') + ->disableOriginalConstructor() + ->getMock(); + $mount = new \OC\Files\Mount\Mount($storage, '/foo', array(), $loader); + $this->assertInstanceOf('\OC\Files\Storage\Wrapper', $mount->getStorage()); + } +} |