blob: 5ff7c797508357b1b7e7528f5dbf98d2efce4ea3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Test\Group;
use OC\Group\Group;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Group\Backend\ABackend;
use OCP\Group\Backend\IHideFromCollaborationBackend;
use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
abstract class HideFromCollaborationBackendTest extends ABackend implements IHideFromCollaborationBackend {
}
class HideFromCollaborationTest extends TestCase {
private IUserManager&MockObject $userManager;
private IEventDispatcher&MockObject $dispatcher;
protected function setUp(): void {
parent::setUp();
$this->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);
}
}
|