aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-02-03 13:23:40 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2020-03-18 13:41:04 +0100
commit451c8761a710c62bc19b75ceba9de670b95aca9e (patch)
tree5262bf946bdd34ed592b39ee4b4a78f1751208ee /apps/dav
parent7819a904d7fe2db2bf48a1e041db6aa84976e4bd (diff)
downloadnextcloud-server-451c8761a710c62bc19b75ceba9de670b95aca9e.tar.gz
nextcloud-server-451c8761a710c62bc19b75ceba9de670b95aca9e.zip
use INode instead of Node for custom properties
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/DAV/CustomPropertiesBackend.php11
-rw-r--r--apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php15
2 files changed, 20 insertions, 6 deletions
diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php
index 5a0128e52ca..5e0842200b4 100644
--- a/apps/dav/lib/DAV/CustomPropertiesBackend.php
+++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php
@@ -32,6 +32,7 @@ use OCP\IDBConnection;
use OCP\IUser;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\Exception\ServiceUnavailable;
+use Sabre\DAV\INode;
use Sabre\DAV\PropertyStorage\Backend\BackendInterface;
use Sabre\DAV\PropFind;
use Sabre\DAV\PropPatch;
@@ -103,7 +104,7 @@ class CustomPropertiesBackend implements BackendInterface {
public function propFind($path, PropFind $propFind) {
try {
$node = $this->tree->getNodeForPath($path);
- if (!($node instanceof Node)) {
+ if (!($node instanceof INode)) {
return;
}
} catch (ServiceUnavailable $e) {
@@ -168,7 +169,7 @@ class CustomPropertiesBackend implements BackendInterface {
*/
public function propPatch($path, PropPatch $propPatch) {
$node = $this->tree->getNodeForPath($path);
- if (!($node instanceof Node)) {
+ if (!($node instanceof INode)) {
return;
}
@@ -220,7 +221,7 @@ class CustomPropertiesBackend implements BackendInterface {
* http://www.example.org/namespace#author If the array is empty, all
* properties should be returned
*/
- private function getProperties(Node $node, array $requestedProperties) {
+ private function getProperties(INode $node, array $requestedProperties) {
$path = $node->getPath();
if (isset($this->cache[$path])) {
return $this->cache[$path];
@@ -259,12 +260,12 @@ class CustomPropertiesBackend implements BackendInterface {
/**
* Update properties
*
- * @param Node $node node for which to update properties
+ * @param INode $node node for which to update properties
* @param array $properties array of properties to update
*
* @return bool
*/
- private function updateProperties($node, $properties) {
+ private function updateProperties(INode $node, array $properties) {
$path = $node->getPath();
$deleteStatement = 'DELETE FROM `*PREFIX*properties`' .
diff --git a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
index 3250361ed17..9f0fbdc3a01 100644
--- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
+++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
@@ -29,6 +29,7 @@ use OCA\DAV\DAV\CustomPropertiesBackend;
use OCP\IDBConnection;
use OCP\IUser;
use Sabre\DAV\Exception\NotFound;
+use Sabre\DAV\INode;
use Sabre\DAV\PropFind;
use Sabre\DAV\PropPatch;
use Sabre\DAV\Tree;
@@ -82,9 +83,21 @@ class CustomPropertiesBackendTest extends TestCase {
/**
* @param string $path
- * @return Node|\PHPUnit\Framework\MockObject\MockObject
+ * @return INode|\PHPUnit\Framework\MockObject\MockObject
*/
private function addNode($path) {
+ $node = $this->createMock(INode::class);
+ $node->method('getPath')
+ ->willReturn($path);
+ $this->nodes[$path] = $node;
+ return $node;
+ }
+
+ /**
+ * @param string $path
+ * @return Node|\PHPUnit\Framework\MockObject\MockObject
+ */
+ private function addCalendar($path) {
$node = $this->createMock(Node::class);
$node->method('getPath')
->willReturn($path);