From: Thomas Müller Date: Thu, 2 Apr 2015 13:19:09 +0000 (+0200) Subject: Adding unit test for read and write of big file X-Git-Tag: v8.1.0alpha1~78^2~22 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b3c5ef3afef572a29011af3aaff4649f2e0563df;p=nextcloud-server.git Adding unit test for read and write of big file --- 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 */