diff options
author | Robin Appelman <robin@icewind.nl> | 2022-08-26 15:59:29 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-09-15 17:23:16 +0200 |
commit | d8961ed10f50b8c9fcb87e7ea68cb60768a9607f (patch) | |
tree | 98e33bea174c4c2f4d3df9c57c9f0590894f11a3 /tests/lib/Files/ObjectStore/ObjectStoreTest.php | |
parent | c41982e108563929c9efdc81e0f6f9c611412489 (diff) | |
download | nextcloud-server-d8961ed10f50b8c9fcb87e7ea68cb60768a9607f.tar.gz nextcloud-server-d8961ed10f50b8c9fcb87e7ea68cb60768a9607f.zip |
fix using FSEEK_END with SeekableHttpStream to get file size
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Files/ObjectStore/ObjectStoreTest.php')
-rw-r--r-- | tests/lib/Files/ObjectStore/ObjectStoreTest.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreTest.php b/tests/lib/Files/ObjectStore/ObjectStoreTest.php index a245f0ae366..2333168d838 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreTest.php @@ -143,4 +143,19 @@ abstract class ObjectStoreTest extends TestCase { $this->assertEquals('foobar', stream_get_contents($instance->readObject('target'))); } + + public function testFseekSize() { + $instance = $this->getInstance(); + + $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; + $size = filesize($textFile); + $instance->writeObject('source', fopen($textFile, 'r')); + + $fh = $instance->readObject('source'); + + fseek($fh, 0, SEEK_END); + $pos = ftell($fh); + + $this->assertEquals($size, $pos); + } } |