diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index f1107ecb4a11b..6a23822755919 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -4103,12 +4103,6 @@ - - - - - - diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index 147c5baf5438a..6e42fad8b9f6b 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -377,7 +377,7 @@ public function canAddUser(): bool { */ public function hideFromCollaboration(): bool { return array_reduce($this->backends, function (bool $hide, GroupInterface $backend) { - return $hide | ($backend instanceof IHideFromCollaborationBackend && $backend->hideGroup($this->gid)); + return $hide || ($backend instanceof IHideFromCollaborationBackend && $backend->hideGroup($this->gid)); }, false); } } diff --git a/tests/lib/Group/HideFromCollaborationTest.php b/tests/lib/Group/HideFromCollaborationTest.php new file mode 100644 index 0000000000000..5ff7c79750835 --- /dev/null +++ b/tests/lib/Group/HideFromCollaborationTest.php @@ -0,0 +1,53 @@ +userManager = $this->createMock(IUserManager::class); + $this->dispatcher = $this->createMock(IEventDispatcher::class); + } + + + public function testHideFromCollaboration(): void { + // Arrange + $backend1 = $this->createMock(HideFromCollaborationBackendTest::class); + $backend1->method('hideGroup') + ->willReturn(false); + $backend2 = $this->createMock(HideFromCollaborationBackendTest::class); + $backend2->method('hideGroup') + ->willReturn(true); + $group = new Group('group1', [$backend1, $backend2], $this->dispatcher, $this->userManager); + + // Act + $result = $group->hideFromCollaboration(); + + // Assert + $this->assertTrue($result); + } +}