Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-10-31 21:41:55 +0300
committerRobin Appelman <robin@icewind.nl>2018-10-31 23:10:57 +0300
commit9b3cc72f7c033c4dba9a2b1e21e0e38f488318b5 (patch)
tree288135a768e3a77700a8addb9b1b9a7a8b27a925 /tests
parent4094a5e74a6d64050bbaeac8325895c9b226f328 (diff)
fix writeStream for jail wrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-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'));
+ }
}