From 8c42e2de8c8be9bd5914794dbf01a10f575788d1 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 26 Jan 2013 23:49:14 +0100 Subject: Test cases for new mount management --- tests/lib/files/mount.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/lib/files/mount.php (limited to 'tests') diff --git a/tests/lib/files/mount.php b/tests/lib/files/mount.php new file mode 100644 index 00000000000..9f16b036275 --- /dev/null +++ b/tests/lib/files/mount.php @@ -0,0 +1,37 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace Test\Files; + +use \OC\Files\Storage\Temporary; + +class Mount extends \PHPUnit_Framework_TestCase { + public function setup() { + \OC_Util::setupFS(); + \OC\Files\Mount::clear(); + } + + public function testFind() { + $this->assertNull(\OC\Files\Mount::find('/')); + + $rootMount = new \OC\Files\Mount(new Temporary(array()), '/'); + $this->assertEquals($rootMount, \OC\Files\Mount::find('/')); + $this->assertEquals($rootMount, \OC\Files\Mount::find('/foo/bar')); + + $mount = new \OC\Files\Mount(new Temporary(array()), '/foo'); + $this->assertEquals($rootMount, \OC\Files\Mount::find('/')); + $this->assertEquals($mount, \OC\Files\Mount::find('/foo/bar')); + + $this->assertEquals(1, count(\OC\Files\Mount::findIn('/'))); + new \OC\Files\Mount(new Temporary(array()), '/bar'); + $this->assertEquals(2, count(\OC\Files\Mount::findIn('/'))); + + $id = $mount->getStorageId(); + $this->assertEquals($mount, \OC\Files\Mount::findById($id)); + } +} -- cgit v1.2.3