summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-10-31 19:41:55 +0100
committerRobin Appelman <robin@icewind.nl>2018-10-31 21:10:57 +0100
commit9b3cc72f7c033c4dba9a2b1e21e0e38f488318b5 (patch)
tree288135a768e3a77700a8addb9b1b9a7a8b27a925 /tests/lib
parent4094a5e74a6d64050bbaeac8325895c9b226f328 (diff)
downloadnextcloud-server-9b3cc72f7c033c4dba9a2b1e21e0e38f488318b5.tar.gz
nextcloud-server-9b3cc72f7c033c4dba9a2b1e21e0e38f488318b5.zip
fix writeStream for jail wrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/Files/Storage/Storage.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php
index 04aafece2e3..a25a3f74f9e 100644
--- a/tests/lib/Files/Storage/Storage.php
+++ b/tests/lib/Files/Storage/Storage.php
@@ -23,6 +23,7 @@
namespace Test\Files\Storage;
use OC\Files\Cache\Watcher;
+use OCP\Files\Storage\IWriteStreamStorage;
abstract class Storage extends \Test\TestCase {
/**
@@ -628,4 +629,20 @@ abstract class Storage extends \Test\TestCase {
$this->instance->rename('bar.txt.part', 'bar.txt');
$this->assertEquals('bar', $this->instance->file_get_contents('bar.txt'));
}
+
+ public function testWriteStream() {
+ $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
+
+ if (!$this->instance->instanceOfStorage(IWriteStreamStorage::class)) {
+ $this->markTestSkipped('Not a WriteSteamStorage');
+ }
+ /** @var IWriteStreamStorage $storage */
+ $storage = $this->instance;
+
+ $source = fopen($textFile, 'r');
+
+ $storage->writeStream('test.txt', $source);
+ $this->assertTrue($storage->file_exists('test.txt'));
+ $this->assertEquals(file_get_contents($textFile), $storage->file_get_contents('test.txt'));
+ }
}