diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-01-28 15:35:30 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-01-28 15:35:30 +0100 |
commit | 232cc3211b2b312d4e32e7d0fb482a2b7affe89a (patch) | |
tree | 7ce85f453c837717b3b4263b30a1f3c18f28fdf9 /tests | |
parent | c9c919da5738f963247307ca3878e06beff87ade (diff) | |
download | nextcloud-server-232cc3211b2b312d4e32e7d0fb482a2b7affe89a.tar.gz nextcloud-server-232cc3211b2b312d4e32e7d0fb482a2b7affe89a.zip |
add oc:// streamwrapper to provide access to ownCloud's virtual filesystem
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/streamwrappers.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/streamwrappers.php b/tests/lib/streamwrappers.php index e40f2e76128..2237ee7d378 100644 --- a/tests/lib/streamwrappers.php +++ b/tests/lib/streamwrappers.php @@ -75,4 +75,23 @@ class Test_StreamWrappers extends PHPUnit_Framework_TestCase { public static function closeCallBack($path) { throw new Exception($path); } + + public function testOC() { + \OC\Files\Mount::clear(); + $storage = new \OC\Files\Storage\Temporary(array()); + $storage->file_put_contents('foo.txt', 'asd'); + new \OC\Files\Mount($storage, '/'); + + $this->assertTrue(file_exists('oc:///foo.txt')); + $this->assertEquals('asd', file_get_contents('oc:///foo.txt')); + $this->assertEquals(array('.', '..', 'foo.txt'), scandir('oc:///')); + + file_put_contents('oc:///bar.txt', 'qwerty'); + $this->assertEquals('qwerty', $storage->file_get_contents('bar.txt')); + $this->assertEquals(array('.', '..', 'bar.txt', 'foo.txt'), scandir('oc:///')); + $this->assertEquals('qwerty', file_get_contents('oc:///bar.txt')); + + unlink('oc:///foo.txt'); + $this->assertEquals(array('.', '..', 'bar.txt'), scandir('oc:///')); + } } |