[Pkg-owncloud-commits] [owncloud] 53/215: add two tests
David Prévot
taffit at moszumanska.debian.org
Tue May 5 01:01:21 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit 7a34f75da6081dfc6d85c2498b1a68838c28fb18
Author: jknockaert <jasper at knockaert.nl>
Date: Tue Apr 21 17:36:25 2015 +0200
add two tests
testRewind tests reading and writing after rewind on an encrypted stream; testWriteWriteRead tests r+ mode
---
tests/lib/files/stream/encryption.php | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/tests/lib/files/stream/encryption.php b/tests/lib/files/stream/encryption.php
index 1da2082..024185b 100644
--- a/tests/lib/files/stream/encryption.php
+++ b/tests/lib/files/stream/encryption.php
@@ -152,6 +152,36 @@ class Encryption extends \Test\TestCase {
unlink($fileName);
}
+ public function testWriteWriteRead() {
+ $fileName = tempnam("/tmp", "FOO");
+ $stream = $this->getStream($fileName, 'w+', 0);
+ $this->assertEquals(6, fwrite($stream, 'foobar'));
+ fclose($stream);
+
+ $stream = $this->getStream($fileName, 'r+', 6);
+ $this->assertEquals(3, fwrite($stream, 'bar'));
+ fclose($stream);
+
+ $stream = $this->getStream($fileName, 'r', 6);
+ $this->assertEquals('barbar', fread($stream, 100));
+ fclose($stream);
+ }
+
+ public function testRewind() {
+ $fileName = tempnam("/tmp", "FOO");
+ $stream = $this->getStream($fileName, 'w+', 0);
+ $this->assertEquals(6, fwrite($stream, 'foobar'));
+ $this->assertEquals(TRUE, rewind($stream));
+ $this->assertEquals('foobar', fread($stream, 100));
+ $this->assertEquals(TRUE, rewind($stream));
+ $this->assertEquals(3, fwrite($stream, 'bar'));
+ fclose($stream);
+
+ $stream = $this->getStream($fileName, 'r', 6);
+ $this->assertEquals('barbar', fread($stream, 100));
+ fclose($stream);
+ }
+
public function testSeek() {
$fileName = tempnam("/tmp", "FOO");
$stream = $this->getStream($fileName, 'w+', 0);
--
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