]> source.dussan.org Git - nextcloud-server.git/commitdiff
Adding unit test for read and write of big file
authorThomas Müller <thomas.mueller@tmit.eu>
Thu, 2 Apr 2015 13:19:09 +0000 (15:19 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 7 Apr 2015 11:30:31 +0000 (13:30 +0200)
tests/lib/files/stream/encryption.php

index fac1b76855430ddfb3112896c54b2775ac639f2f..c7e7f0ddf9505a13962f3af85edef056614326c4 100644 (file)
@@ -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
         */