[Pkg-owncloud-commits] [owncloud] 13/67: some test cases for fopen of storage backends

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:10:32 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.5.1
in repository owncloud.

commit e55fc87ad300168db05568dc5ebb634a57e5b004
Author: Robin Appelman <icewind at owncloud.com>
Date:   Thu Oct 11 19:38:32 2012 +0200

    some test cases for fopen of storage backends
---
 tests/lib/filestorage.php |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/lib/filestorage.php b/tests/lib/filestorage.php
index 4191b0c..8156aeb 100644
--- a/tests/lib/filestorage.php
+++ b/tests/lib/filestorage.php
@@ -221,4 +221,24 @@ abstract class Test_FileStorage extends UnitTestCase {
 		$this->assertNotIdentical(false, array_search('/logo-wide.svg', $result));
 		$this->assertNotIdentical(false, array_search('/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);
+	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list