diff options
author | Hamza Mahjoubi <hamzamahjoubi221@gmail.com> | 2024-06-10 16:30:53 +0200 |
---|---|---|
committer | Hamza Mahjoubi <hamzamahjoubi221@gmail.com> | 2024-07-01 15:10:16 +0200 |
commit | a9774741e815c02a9f5973bf6477a7c9da653732 (patch) | |
tree | 171ab358957d002bd4e13dea0d532d0c826ca51c /tests/lib/User/AvailabilityCoordinatorTest.php | |
parent | 3b75c5b98cd0356e99c07d9696c49732f195b3f6 (diff) | |
download | nextcloud-server-a9774741e815c02a9f5973bf6477a7c9da653732.tar.gz nextcloud-server-a9774741e815c02a9f5973bf6477a7c9da653732.zip |
Feat: Allow users to select another user as their out-of-office replacement
Signed-off-by: Hamza Mahjoubi <hamzamahjoubi221@gmail.com>
Diffstat (limited to 'tests/lib/User/AvailabilityCoordinatorTest.php')
-rw-r--r-- | tests/lib/User/AvailabilityCoordinatorTest.php | 18 |
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); |