summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-07-01 16:16:40 +0200
committerJoas Schilling <coding@schilljs.com>2016-07-01 16:16:40 +0200
commit28b3a0a37e22f8a35a71d2e56e8ffa4a144b9ab7 (patch)
tree5bd43f6e536b681c66abad87f16bbff15417d6e5
parent75c172a062579a5f28551eeb37d9145c451f1867 (diff)
downloadnextcloud-server-28b3a0a37e22f8a35a71d2e56e8ffa4a144b9ab7.tar.gz
nextcloud-server-28b3a0a37e22f8a35a71d2e56e8ffa4a144b9ab7.zip
Fix DAV tests with phpunit 5.2+
-rw-r--r--apps/dav/tests/unit/connector/sabre/filesplugin.php48
1 files changed, 26 insertions, 22 deletions
diff --git a/apps/dav/tests/unit/connector/sabre/filesplugin.php b/apps/dav/tests/unit/connector/sabre/filesplugin.php
index ecad56d004d..b664d7caaed 100644
--- a/apps/dav/tests/unit/connector/sabre/filesplugin.php
+++ b/apps/dav/tests/unit/connector/sabre/filesplugin.php
@@ -84,32 +84,37 @@ class FilesPlugin extends \Test\TestCase {
/**
* @param string $class
+ * @param bool $hasAllMethods
+ * @return \PHPUnit_Framework_MockObject_MockObject|\Sabre\DAV\IFile
*/
- private function createTestNode($class) {
+ private function createTestNode($class, $hasAllMethods = true)
+ {
$node = $this->getMockBuilder($class)
->disableOriginalConstructor()
->getMock();
- $node->expects($this->any())
- ->method('getId')
- ->will($this->returnValue(123));
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/dummypath')
->will($this->returnValue($node));
- $node->expects($this->any())
- ->method('getFileId')
- ->will($this->returnValue('00000123instanceid'));
- $node->expects($this->any())
- ->method('getInternalFileId')
- ->will($this->returnValue('123'));
- $node->expects($this->any())
- ->method('getEtag')
- ->will($this->returnValue('"abc"'));
- $node->expects($this->any())
- ->method('getDavPermissions')
- ->will($this->returnValue('DWCKMSR'));
+ if ($hasAllMethods) {
+ $node->expects($this->any())
+ ->method('getId')
+ ->will($this->returnValue(123));
+ $node->expects($this->any())
+ ->method('getFileId')
+ ->will($this->returnValue('00000123instanceid'));
+ $node->expects($this->any())
+ ->method('getInternalFileId')
+ ->will($this->returnValue('123'));
+ $node->expects($this->any())
+ ->method('getEtag')
+ ->will($this->returnValue('"abc"'));
+ $node->expects($this->any())
+ ->method('getDavPermissions')
+ ->will($this->returnValue('DWCKMSR'));
+ }
return $node;
}
@@ -169,7 +174,7 @@ class FilesPlugin extends \Test\TestCase {
}
public function testGetPropertiesForFileHome() {
- $node = $this->createTestNode('\OCA\DAV\Files\FilesHome');
+ $node = $this->createTestNode('\OCA\DAV\Files\FilesHome', false);
$propFind = new \Sabre\DAV\PropFind(
'/dummyPath',
@@ -190,9 +195,9 @@ class FilesPlugin extends \Test\TestCase {
->disableOriginalConstructor()->getMock();
$user->expects($this->never())->method('getUID');
$user->expects($this->never())->method('getDisplayName');
- $node->expects($this->never())->method('getDirectDownload');
- $node->expects($this->never())->method('getOwner');
- $node->expects($this->never())->method('getSize');
+ // Method does not exist: $node->expects($this->never())->method('getDirectDownload');
+ // Method does not exist: $node->expects($this->never())->method('getOwner');
+ // Method does not exist: $node->expects($this->never())->method('getSize');
$this->plugin->handleGetProperties(
$propFind,
@@ -285,8 +290,7 @@ class FilesPlugin extends \Test\TestCase {
0
);
- $node->expects($this->never())
- ->method('getDirectDownload');
+ // Method does not exist: $node->expects($this->never())->method('getDirectDownload');
$node->expects($this->once())
->method('getSize')
->will($this->returnValue(1025));