aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel <mail@danielkesselberg.de>2024-07-01 23:25:43 +0200
committerGitHub <noreply@github.com>2024-07-01 23:25:43 +0200
commit92acbb0d39728b9bfc7530957611ff19aec31d84 (patch)
treec8f0f1df41fea66794f17daf087b2f2be44cffb4 /tests
parent55f3e53695933bbc2d928185694cd1b67fd46fef (diff)
parenta9774741e815c02a9f5973bf6477a7c9da653732 (diff)
downloadnextcloud-server-92acbb0d39728b9bfc7530957611ff19aec31d84.tar.gz
nextcloud-server-92acbb0d39728b9bfc7530957611ff19aec31d84.zip
Merge pull request #45766 from nextcloud/feat/ooo-replacement
Feat: Allow users to select another user as their out-of-office replacement
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/User/AvailabilityCoordinatorTest.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/lib/User/AvailabilityCoordinatorTest.php b/tests/lib/User/AvailabilityCoordinatorTest.php
index 1b880575448..8b9446279a6 100644
--- a/tests/lib/User/AvailabilityCoordinatorTest.php
+++ b/tests/lib/User/AvailabilityCoordinatorTest.php
@@ -73,6 +73,8 @@ class AvailabilityCoordinatorTest extends TestCase {
$absence->setLastDay('2023-10-08');
$absence->setStatus('Vacation');
$absence->setMessage('On vacation');
+ $absence->setReplacementUserId('batman');
+ $absence->setReplacementUserDisplayName('Bruce Wayne');
$this->timezoneService->method('getUserTimezone')->with('user')->willReturn('Europe/Berlin');
$user = $this->createMock(IUser::class);
@@ -89,7 +91,7 @@ class AvailabilityCoordinatorTest extends TestCase {
$this->cache->expects(self::exactly(2))
->method('set')
->withConsecutive([$user->getUID() . '_timezone', 'Europe/Berlin', 3600],
- [$user->getUID(), '{"id":"420","startDate":1696111200,"endDate":1696802340,"shortMessage":"Vacation","message":"On vacation"}', 300]);
+ [$user->getUID(), '{"id":"420","startDate":1696111200,"endDate":1696802340,"shortMessage":"Vacation","message":"On vacation","replacementUserId":"batman","replacementUserDisplayName":"Bruce Wayne"}', 300]);
$expected = new OutOfOfficeData(
'420',
@@ -98,6 +100,8 @@ class AvailabilityCoordinatorTest extends TestCase {
1696802340,
'Vacation',
'On vacation',
+ 'batman',
+ 'Bruce Wayne',
);
$actual = $this->availabilityCoordinator->getCurrentOutOfOfficeData($user);
self::assertEquals($expected, $actual);
@@ -111,6 +115,8 @@ class AvailabilityCoordinatorTest extends TestCase {
$absence->setLastDay('2023-10-08');
$absence->setStatus('Vacation');
$absence->setMessage('On vacation');
+ $absence->setReplacementUserId('batman');
+ $absence->setReplacementUserDisplayName('Bruce Wayne');
$user = $this->createMock(IUser::class);
$user->method('getUID')
@@ -118,7 +124,7 @@ class AvailabilityCoordinatorTest extends TestCase {
$this->cache->expects(self::exactly(2))
->method('get')
- ->willReturnOnConsecutiveCalls('UTC', '{"id":"420","startDate":1696118400,"endDate":1696809540,"shortMessage":"Vacation","message":"On vacation"}');
+ ->willReturnOnConsecutiveCalls('UTC', '{"id":"420","startDate":1696118400,"endDate":1696809540,"shortMessage":"Vacation","message":"On vacation","replacementUserId":"batman","replacementUserDisplayName":"Bruce Wayne"}');
$this->absenceService->expects(self::never())
->method('getAbsence');
$this->cache->expects(self::exactly(1))
@@ -131,6 +137,8 @@ class AvailabilityCoordinatorTest extends TestCase {
1696809540,
'Vacation',
'On vacation',
+ 'batman',
+ 'Bruce Wayne'
);
$actual = $this->availabilityCoordinator->getCurrentOutOfOfficeData($user);
self::assertEquals($expected, $actual);
@@ -170,6 +178,8 @@ class AvailabilityCoordinatorTest extends TestCase {
$absence->setLastDay('2023-10-08');
$absence->setStatus('Vacation');
$absence->setMessage('On vacation');
+ $absence->setReplacementUserId('batman');
+ $absence->setReplacementUserDisplayName('Bruce Wayne');
$this->timezoneService->method('getUserTimezone')->with('user')->willReturn('Europe/Berlin');
$user = $this->createMock(IUser::class);
@@ -185,7 +195,7 @@ class AvailabilityCoordinatorTest extends TestCase {
->willReturn($absence);
$this->cache->expects(self::once())
->method('set')
- ->with('user', '{"id":"420","startDate":1696118400,"endDate":1696809540,"shortMessage":"Vacation","message":"On vacation"}', 300);
+ ->with('user', '{"id":"420","startDate":1696118400,"endDate":1696809540,"shortMessage":"Vacation","message":"On vacation","replacementUserId":"batman","replacementUserDisplayName":"Bruce Wayne"}', 300);
$expected = new OutOfOfficeData(
'420',
@@ -194,6 +204,8 @@ class AvailabilityCoordinatorTest extends TestCase {
1696809540,
'Vacation',
'On vacation',
+ 'batman',
+ 'Bruce Wayne'
);
$actual = $this->availabilityCoordinator->getCurrentOutOfOfficeData($user);
self::assertEquals($expected, $actual);