summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-04-14 15:25:52 +0200
committerRobin Appelman <icewind@owncloud.com>2015-04-14 15:25:52 +0200
commit308af8b909822b1d1e3b601061d56d9e34585dff (patch)
treedc2066acff0cc90d43b33459f58fe1323488ff13 /tests
parent2fd44dbde44c3540d664ade0df277553e7759186 (diff)
downloadnextcloud-server-308af8b909822b1d1e3b601061d56d9e34585dff.tar.gz
nextcloud-server-308af8b909822b1d1e3b601061d56d9e34585dff.zip
pass a stream to the tests
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/connector/sabre/file.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/lib/connector/sabre/file.php b/tests/lib/connector/sabre/file.php
index 13884656310..3fe5c2751f1 100644
--- a/tests/lib/connector/sabre/file.php
+++ b/tests/lib/connector/sabre/file.php
@@ -10,6 +10,13 @@ namespace Test\Connector\Sabre;
class File extends \Test\TestCase {
+ private function getStream($string) {
+ $stream = fopen('php://temp', 'r+');
+ fwrite($stream, $string);
+ fseek($stream, 0);
+ return $stream;
+ }
+
/**
* @expectedException \Sabre\DAV\Exception
*/
@@ -29,7 +36,7 @@ class File extends \Test\TestCase {
->will($this->returnValue('/test.txt'));
$info = new \OC\Files\FileInfo('/test.txt', null, null, array(
- 'permissions'=>\OCP\Constants::PERMISSION_ALL
+ 'permissions' => \OCP\Constants::PERMISSION_ALL
), null);
$file = new \OC\Connector\Sabre\File($view, $info);
@@ -64,7 +71,7 @@ class File extends \Test\TestCase {
$file = new \OC\Connector\Sabre\File($view, $info);
- $this->assertNotEmpty($file->put('test data'));
+ $this->assertNotEmpty($file->put($this->getStream('test data')));
}
/**
@@ -99,7 +106,7 @@ class File extends \Test\TestCase {
$file = new \OC\Connector\Sabre\File($view, $info);
// action
- $file->put('test data');
+ $file->put($this->getStream('test data'));
}
/**
@@ -122,11 +129,12 @@ class File extends \Test\TestCase {
$file = new \OC\Connector\Sabre\File($view, $info);
// action
- $file->put('test data');
+ $file->put($this->getStream('test data'));
}
/**
* Test setting name with setName() with invalid chars
+ *
* @expectedException \OC\Connector\Sabre\Exception\InvalidPath
*/
public function testSetNameInvalidChars() {
@@ -176,7 +184,7 @@ class File extends \Test\TestCase {
$file = new \OC\Connector\Sabre\File($view, $info);
// action
- $file->put('test data');
+ $file->put($this->getStream('test data'));
}
/**