aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/User
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2023-11-13 17:36:24 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2023-11-23 17:18:49 +0100
commit8191295f66cdea5da7854bfad01ad9540c4a55f4 (patch)
tree93fd27fe91ab0f40b4c765139a957b420806dedf /tests/lib/User
parent953382e937a4085c1099449b29c40c7aab02fc3e (diff)
downloadnextcloud-server-8191295f66cdea5da7854bfad01ad9540c4a55f4.tar.gz
nextcloud-server-8191295f66cdea5da7854bfad01ad9540c4a55f4.zip
feat(dav): dispatch out-of-office started and ended events
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'tests/lib/User')
-rw-r--r--tests/lib/User/AvailabilityCoordinatorTest.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/lib/User/AvailabilityCoordinatorTest.php b/tests/lib/User/AvailabilityCoordinatorTest.php
index fd850fcdfd7..8a0b66181d2 100644
--- a/tests/lib/User/AvailabilityCoordinatorTest.php
+++ b/tests/lib/User/AvailabilityCoordinatorTest.php
@@ -28,6 +28,7 @@ namespace Test\User;
use OC\User\AvailabilityCoordinator;
use OC\User\OutOfOfficeData;
+use OCA\DAV\CalDAV\TimezoneService;
use OCA\DAV\Db\Absence;
use OCA\DAV\Db\AbsenceMapper;
use OCP\ICache;
@@ -45,6 +46,7 @@ class AvailabilityCoordinatorTest extends TestCase {
private IConfig|MockObject $config;
private AbsenceMapper $absenceMapper;
private LoggerInterface $logger;
+ private MockObject|TimezoneService $timezoneService;
protected function setUp(): void {
parent::setUp();
@@ -54,6 +56,7 @@ class AvailabilityCoordinatorTest extends TestCase {
$this->absenceMapper = $this->createMock(AbsenceMapper::class);
$this->config = $this->createMock(IConfig::class);
$this->logger = $this->createMock(LoggerInterface::class);
+ $this->timezoneService = $this->createMock(TimezoneService::class);
$this->cacheFactory->expects(self::once())
->method('createLocal')
@@ -64,6 +67,7 @@ class AvailabilityCoordinatorTest extends TestCase {
$this->absenceMapper,
$this->config,
$this->logger,
+ $this->timezoneService,
);
}
@@ -86,6 +90,7 @@ class AvailabilityCoordinatorTest extends TestCase {
$absence->setLastDay('2023-10-08');
$absence->setStatus('Vacation');
$absence->setMessage('On vacation');
+ $this->timezoneService->method('getUserTimezone')->with('user')->willReturn('Europe/Berlin');
$user = $this->createMock(IUser::class);
$user->method('getUID')
@@ -101,13 +106,13 @@ class AvailabilityCoordinatorTest extends TestCase {
->willReturn($absence);
$this->cache->expects(self::once())
->method('set')
- ->with('user', '{"id":"420","startDate":1696118400,"endDate":1696723200,"shortMessage":"Vacation","message":"On vacation"}', 300);
+ ->with('user', '{"id":"420","startDate":1696111200,"endDate":1696802340,"shortMessage":"Vacation","message":"On vacation"}', 300);
$expected = new OutOfOfficeData(
'420',
$user,
- 1696118400,
- 1696723200,
+ 1696111200,
+ 1696802340,
'Vacation',
'On vacation',
);
@@ -149,6 +154,7 @@ class AvailabilityCoordinatorTest extends TestCase {
$absence->setLastDay('2023-10-08');
$absence->setStatus('Vacation');
$absence->setMessage('On vacation');
+ $this->timezoneService->method('getUserTimezone')->with('user')->willReturn('Europe/Berlin');
$user = $this->createMock(IUser::class);
$user->method('getUID')
@@ -164,13 +170,13 @@ class AvailabilityCoordinatorTest extends TestCase {
->willReturn($absence);
$this->cache->expects(self::once())
->method('set')
- ->with('user', '{"id":"420","startDate":1696118400,"endDate":1696723200,"shortMessage":"Vacation","message":"On vacation"}', 300);
+ ->with('user', '{"id":"420","startDate":1696111200,"endDate":1696802340,"shortMessage":"Vacation","message":"On vacation"}', 300);
$expected = new OutOfOfficeData(
'420',
$user,
- 1696118400,
- 1696723200,
+ 1696111200,
+ 1696802340,
'Vacation',
'On vacation',
);