diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-10-11 19:38:32 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-10-11 22:18:34 +0200 |
commit | 29c43b7d61dd0c3a34566291a6ab1f9a8e077bdd (patch) | |
tree | 763ec601ce845c9263df92dd59562557ed4706f2 /tests | |
parent | c4e301d48f470f46a7c37170cebe3e6f62d5285d (diff) | |
download | nextcloud-server-29c43b7d61dd0c3a34566291a6ab1f9a8e077bdd.tar.gz nextcloud-server-29c43b7d61dd0c3a34566291a6ab1f9a8e077bdd.zip |
some test cases for fopen of storage backends
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/filestorage.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/lib/filestorage.php b/tests/lib/filestorage.php index 7c2d86e6b66..d1f70e87091 100644 --- a/tests/lib/filestorage.php +++ b/tests/lib/filestorage.php @@ -221,4 +221,24 @@ abstract class Test_FileStorage extends UnitTestCase { $this->assertContains('/logo-wide.svg', $result); $this->assertContains('/logo-wide.png', $result); } + + public function testFOpen() { + $textFile = OC::$SERVERROOT . '/tests/data/lorem.txt'; + + $fh = @$this->instance->fopen('foo', 'r'); + if ($fh) { + fclose($fh); + } + $this->assertFalse($fh); + $this->assertFalse($this->instance->file_exists('foo')); + + $fh = $this->instance->fopen('foo', 'w'); + fwrite($fh, file_get_contents($textFile)); + fclose($fh); + $this->assertTrue($this->instance->file_exists('foo')); + + $fh = $this->instance->fopen('foo', 'r'); + $content = stream_get_contents($fh); + $this->assertEqual(file_get_contents($textFile), $content); + } } |