summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Connector/Sabre
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-06-21 18:01:49 +0200
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2023-07-07 14:54:56 +0000
commit749efc1ba17533ccd98a7aff9fb48ddfdae26501 (patch)
treee1a9195ff8c74ebea381c594f2626765957ec0dd /apps/dav/tests/unit/Connector/Sabre
parent0b4db60d3b97652fbf60b3e817340d255964892d (diff)
downloadnextcloud-server-749efc1ba17533ccd98a7aff9fb48ddfdae26501.tar.gz
nextcloud-server-749efc1ba17533ccd98a7aff9fb48ddfdae26501.zip
fix: cominbation of small fixes
- possible null return - parameter name mismatch in implementation - incomplete unit test Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/dav/tests/unit/Connector/Sabre')
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
index 7cb2d85fe1f..f1f1cc8b27f 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
@@ -890,12 +890,25 @@ class FilesReportPluginTest extends \Test\TestCase {
$filesNode1 = $this->createMock(File::class);
$filesNode1->expects($this->any())
+ ->method('getId')
+ ->willReturn(111);
+ $filesNode1->expects($this->any())
->method('getSize')
->willReturn(12);
$filesNode2 = $this->createMock(Folder::class);
$filesNode2->expects($this->any())
+ ->method('getId')
+ ->willReturn(222);
+ $filesNode2->expects($this->any())
->method('getSize')
->willReturn(10);
+ $filesNode3 = $this->createMock(Folder::class);
+ $filesNode3->expects($this->any())
+ ->method('getId')
+ ->willReturn(333);
+ $filesNode3->expects($this->any())
+ ->method('getSize')
+ ->willReturn(33);
$this->tagManager->expects($this->once())
->method('getTagsByIds')
@@ -903,16 +916,20 @@ class FilesReportPluginTest extends \Test\TestCase {
->willReturn([$tag1, $tag2]);
// main assertion: only user visible tags are being passed through.
- $this->userFolder->expects($this->exactly(1))
+ $this->userFolder->expects($this->exactly(2))
->method('searchBySystemTag')
- ->with('FourFiveSix', $this->anything(), $this->anything(), $this->anything());
+ ->withConsecutive(['OneTwoThree'], ['FourFiveSix'])
+ ->willReturnOnConsecutiveCalls(
+ [$filesNode1, $filesNode2],
+ [$filesNode2, $filesNode3],
+ );
$rules = [
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456'],
];
- $this->invokePrivate($this->plugin, 'processFilterRulesForFileNodes', [$rules, null, null]);
+ $this->assertEquals([$filesNode2], array_values($this->invokePrivate($this->plugin, 'processFilterRulesForFileNodes', [$rules, null, null])));
}
public function testProcessFavoriteFilter(): void {