]> source.dussan.org Git - nextcloud-server.git/commitdiff
fixing unit tests for encryption stream wrapper seek
authorThomas Müller <thomas.mueller@tmit.eu>
Thu, 2 Apr 2015 10:48:41 +0000 (12:48 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 7 Apr 2015 11:30:30 +0000 (13:30 +0200)
tests/lib/files/stream/encryption.php

index 3a5a2d4899ee728b0e07332b14fed004c93fb521..fac1b76855430ddfb3112896c54b2775ac639f2f 100644 (file)
@@ -52,6 +52,19 @@ class Encryption extends \Test\TestCase {
                fclose($stream);
        }
 
+       public function testSeek() {
+               $fileName = tempnam("/tmp", "FOO");
+               $stream = $this->getStream($fileName, 'w+');
+               $this->assertEquals(6, fwrite($stream, 'foobar'));
+               $this->assertEquals(0, fseek($stream, 3));
+               $this->assertEquals(6, fwrite($stream, 'foobar'));
+               fclose($stream);
+
+               $stream = $this->getStream($fileName, 'r');
+               $this->assertEquals('foofoobar', fread($stream, 100));
+               fclose($stream);
+       }
+
        /**
         * @return \PHPUnit_Framework_MockObject_MockObject
         */