diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-06-21 18:01:49 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-06-21 20:28:01 +0200 |
commit | a0f9556f7c68422a5637b4d5f5a1694f7e78e591 (patch) | |
tree | 5ba5fed17a230df4f67887392fd2b8d184ac5dff /apps/dav/tests/unit/Connector | |
parent | 49db546f784e5e1d715a29d737508604b19f69eb (diff) | |
download | nextcloud-server-a0f9556f7c68422a5637b4d5f5a1694f7e78e591.tar.gz nextcloud-server-a0f9556f7c68422a5637b4d5f5a1694f7e78e591.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')
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php | 23 |
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 { |