summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-10-25 12:33:16 +0200
committerVincent Petry <pvince81@owncloud.com>2013-10-25 12:33:16 +0200
commitc8df27de73f845f6d1661386f06304b7c209e7d7 (patch)
treed98ad6e5c6e7305a3a1cd21eaf0285b4a7155d23 /tests
parentd8b245490bf0e74156c66ca594977cbdb2920c4e (diff)
downloadnextcloud-server-c8df27de73f845f6d1661386f06304b7c209e7d7.tar.gz
nextcloud-server-c8df27de73f845f6d1661386f06304b7c209e7d7.zip
Fixed quota stream to not wrap read-only fopen calls
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/storage/wrapper/quota.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/files/storage/wrapper/quota.php
index 3702f8154f5..9b14335782f 100644
--- a/tests/lib/files/storage/wrapper/quota.php
+++ b/tests/lib/files/storage/wrapper/quota.php
@@ -58,4 +58,26 @@ class Quota extends \Test\Files\Storage\Storage {
fclose($stream);
$this->assertEquals('foobarqwe', $instance->file_get_contents('foo'));
}
+
+ public function testReturnRegularStreamOnRead(){
+ $instance = $this->getLimitedStorage(9);
+
+ // create test file first
+ $stream = $instance->fopen('foo', 'w+');
+ fwrite($stream, 'blablacontent');
+ fclose($stream);
+
+ $stream = $instance->fopen('foo', 'r');
+ $meta = stream_get_meta_data($stream);
+ $this->assertEquals('plainfile', $meta['wrapper_type']);
+ fclose($stream);
+ }
+
+ public function testReturnQuotaStreamOnWrite(){
+ $instance = $this->getLimitedStorage(9);
+ $stream = $instance->fopen('foo', 'w+');
+ $meta = stream_get_meta_data($stream);
+ $this->assertEquals('user-space', $meta['wrapper_type']);
+ fclose($stream);
+ }
}