aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-04-02 15:19:09 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-04-07 13:30:31 +0200
commitb3c5ef3afef572a29011af3aaff4649f2e0563df (patch)
treefa027842bc7d73d0cfdadc7fb8489d8f44ece5ec /tests
parent02404a6a8cd07ca79add601deaefe3b4940eddfa (diff)
downloadnextcloud-server-b3c5ef3afef572a29011af3aaff4649f2e0563df.tar.gz
nextcloud-server-b3c5ef3afef572a29011af3aaff4649f2e0563df.zip
Adding unit test for read and write of big file
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/stream/encryption.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/lib/files/stream/encryption.php b/tests/lib/files/stream/encryption.php
index fac1b768554..c7e7f0ddf95 100644
--- a/tests/lib/files/stream/encryption.php
+++ b/tests/lib/files/stream/encryption.php
@@ -65,6 +65,22 @@ class Encryption extends \Test\TestCase {
fclose($stream);
}
+ public function testWriteReadBigFile() {
+ $expectedData = file_get_contents(\OC::$SERVERROOT . '/tests/data/lorem-big.txt');
+ // write it
+ $fileName = tempnam("/tmp", "FOO");
+ $stream = $this->getStream($fileName, 'w+');
+ fwrite($stream, $expectedData);
+ fclose($stream);
+
+ // read it all
+ $stream = $this->getStream($fileName, 'r');
+ $data = stream_get_contents($stream);
+ fclose($stream);
+
+ $this->assertEquals($expectedData, $data);
+ }
+
/**
* @return \PHPUnit_Framework_MockObject_MockObject
*/