Skip to content

Commit

Permalink
fixup! enh(userstatus): add OOO automation and remove calendar automa…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
miaulalala committed Nov 27, 2023
1 parent 7cf179c commit e688c1d
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions tests/lib/User/AvailabilityCoordinatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ public function testGetOutOfOfficeDataInEffect(): void {
->method('set')
->withConsecutive([$user->getUID() . '_timezone', 'Europe/Berlin', 3600],
[$user->getUID(), '{"id":"420","startDate":1696111200,"endDate":1696802340,"shortMessage":"Vacation","message":"On vacation"}', 300]);
$this->absenceService->expects(self::once())
->method('isInEffect')
->willReturn(true);

$expected = new OutOfOfficeData(
'420',
Expand All @@ -123,39 +120,6 @@ public function testGetOutOfOfficeDataInEffect(): void {
self::assertEquals($expected, $actual);
}

public function testGetOutOfOfficeDataNotInEffect(): void {
$absence = new Absence();
$absence->setId(420);
$absence->setUserId('user');
$absence->setFirstDay('2023-10-01');
$absence->setLastDay('2023-10-08');
$absence->setStatus('Vacation');
$absence->setMessage('On vacation');

$user = $this->createMock(IUser::class);
$user->method('getUID')
->willReturn('user');

$this->cache->expects(self::exactly(2))
->method('get')
->willReturnOnConsecutiveCalls(null, null);
$this->timezoneService->expects(self::once())
->method('getUserTimezone')
->willReturn('Europe/Berlin');
$this->absenceService->expects(self::once())
->method('getAbsence')
->with($user->getUID())
->willReturn($absence);
$this->cache->expects(self::exactly(2))
->method('set');
$this->absenceService->expects(self::once())
->method('isInEffect')
->willReturn(false);

$actual = $this->availabilityCoordinator->getCurrentOutOfOfficeData($user);
self::assertNull($actual);
}

public function testGetOutOfOfficeDataCachedAll(): void {
$absence = new Absence();
$absence->setId(420);
Expand All @@ -176,9 +140,6 @@ public function testGetOutOfOfficeDataCachedAll(): void {
->method('getAbsence');
$this->cache->expects(self::exactly(1))
->method('set');
$this->absenceService->expects(self::once())
->method('isInEffect')
->willReturn(true);

$expected = new OutOfOfficeData(
'420',
Expand Down Expand Up @@ -213,8 +174,6 @@ public function testGetOutOfOfficeDataNoData(): void {
->willReturn(null);
$this->cache->expects(self::never())
->method('set');
$this->absenceService->expects(self::never())
->method('isInEffect');

$actual = $this->availabilityCoordinator->getCurrentOutOfOfficeData($user);
self::assertNull($actual);
Expand Down Expand Up @@ -244,9 +203,6 @@ public function testGetOutOfOfficeDataWithInvalidCachedData(): void {
$this->cache->expects(self::once())
->method('set')
->with('user', '{"id":"420","startDate":1696118400,"endDate":1696809540,"shortMessage":"Vacation","message":"On vacation"}', 300);
$this->absenceService->expects(self::once())
->method('isInEffect')
->willReturn(true);

$expected = new OutOfOfficeData(
'420',
Expand Down

0 comments on commit e688c1d

Please sign in to comment.