summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-04-09 14:46:25 +0200
committerRobin Appelman <icewind@owncloud.com>2015-04-09 14:46:25 +0200
commitcbcee34eb04a9b950437f50607d8fe1b88af703a (patch)
treec75d778260f1453ac150a8252d6cf7127253197c /tests
parent6a5950275993394df22b208f1126efae9e35e42b (diff)
downloadnextcloud-server-cbcee34eb04a9b950437f50607d8fe1b88af703a.tar.gz
nextcloud-server-cbcee34eb04a9b950437f50607d8fe1b88af703a.zip
update tests
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/connector/sabre/file.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/lib/connector/sabre/file.php b/tests/lib/connector/sabre/file.php
index 74e289c1751..13884656310 100644
--- a/tests/lib/connector/sabre/file.php
+++ b/tests/lib/connector/sabre/file.php
@@ -15,9 +15,13 @@ class File extends \Test\TestCase {
*/
public function testSimplePutFails() {
// setup
- $view = $this->getMock('\OC\Files\View', array('file_put_contents', 'getRelativePath'), array());
+ $storage = $this->getMock('\OC\Files\Storage\Local', ['fopen'], [['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]]);
+ $view = $this->getMock('\OC\Files\View', array('file_put_contents', 'getRelativePath', 'resolvePath'), array());
$view->expects($this->any())
- ->method('file_put_contents')
+ ->method('resolvePath')
+ ->will($this->returnValue(array($storage, '')));
+ $storage->expects($this->once())
+ ->method('fopen')
->will($this->returnValue(false));
$view->expects($this->any())
@@ -36,8 +40,9 @@ class File extends \Test\TestCase {
public function testPutSingleFileShare() {
// setup
- $storage = $this->getMock('\OCP\Files\Storage');
- $view = $this->getMock('\OC\Files\View', array('file_put_contents', 'getRelativePath'), array());
+ $stream = fopen('php://temp', 'w+');
+ $storage = $this->getMock('\OC\Files\Storage\Local', ['fopen'], [['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]]);
+ $view = $this->getMock('\OC\Files\View', array('file_put_contents', 'getRelativePath', 'resolvePath'), array());
$view->expects($this->any())
->method('resolvePath')
->with('')
@@ -49,6 +54,9 @@ class File extends \Test\TestCase {
->method('file_put_contents')
->with('')
->will($this->returnValue(true));
+ $storage->expects($this->once())
+ ->method('fopen')
+ ->will($this->returnValue($stream));
$info = new \OC\Files\FileInfo('/foo.txt', null, null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL