aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-02-09 11:39:22 +0100
committerVincent Petry <pvince81@owncloud.com>2016-02-09 11:39:22 +0100
commit3028684d8972c58a2146ebbdf1918fd3f730249e (patch)
tree07b7d4443be0de4c34e6380ab0c7c7b08c183b9c /apps/dav/tests
parentd11179a0f5b69ae479c214033a1ffc8d64752c83 (diff)
downloadnextcloud-server-3028684d8972c58a2146ebbdf1918fd3f730249e.tar.gz
nextcloud-server-3028684d8972c58a2146ebbdf1918fd3f730249e.zip
Fix system tag filter AND condition
If one of the results is empty, no need to do array_intersect and return an empty result directly.
Diffstat (limited to 'apps/dav/tests')
-rw-r--r--apps/dav/tests/unit/connector/sabre/filesreportplugin.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/connector/sabre/filesreportplugin.php b/apps/dav/tests/unit/connector/sabre/filesreportplugin.php
index 853e52f5039..54badd323f7 100644
--- a/apps/dav/tests/unit/connector/sabre/filesreportplugin.php
+++ b/apps/dav/tests/unit/connector/sabre/filesreportplugin.php
@@ -395,6 +395,28 @@ class FilesReportPlugin extends \Test\TestCase {
$this->assertEquals(['222'], array_values($this->plugin->processFilterRules($rules)));
}
+ public function testProcessFilterRulesAndConditionWithOneEmptyResult() {
+ $this->groupManager->expects($this->any())
+ ->method('isAdmin')
+ ->will($this->returnValue(true));
+
+ $this->tagMapper->expects($this->at(0))
+ ->method('getObjectIdsForTags')
+ ->with('123')
+ ->will($this->returnValue(['111', '222']));
+ $this->tagMapper->expects($this->at(1))
+ ->method('getObjectIdsForTags')
+ ->with('456')
+ ->will($this->returnValue([]));
+
+ $rules = [
+ ['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
+ ['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456'],
+ ];
+
+ $this->assertEquals([], array_values($this->plugin->processFilterRules($rules)));
+ }
+
public function testProcessFilterRulesInvisibleTagAsAdmin() {
$this->groupManager->expects($this->any())
->method('isAdmin')