aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests
diff options
context:
space:
mode:
authorSebastianKrupinski <krupinskis05@gmail.com>2024-07-18 22:07:33 -0400
committerSebastianKrupinski <krupinskis05@gmail.com>2024-08-07 18:56:34 -0400
commit19ec5985b54d61b99c3a68763a97350b0f7afcc2 (patch)
tree6c0b98027d32b206411b8e475da2fdfd8f930601 /apps/dav/tests
parent749dc7d9aea4005efd0152545111c76a1bfdcbd8 (diff)
downloadnextcloud-server-19ec5985b54d61b99c3a68763a97350b0f7afcc2.tar.gz
nextcloud-server-19ec5985b54d61b99c3a68763a97350b0f7afcc2.zip
fix(caldav): test for null and blank value
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Diffstat (limited to 'apps/dav/tests')
-rw-r--r--apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php29
1 files changed, 28 insertions, 1 deletions
diff --git a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php
index 593131ba5dd..d4594291d88 100644
--- a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php
+++ b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php
@@ -427,7 +427,7 @@ EOD;
$this->reminderService->onCalendarObjectCreate($objectData);
}
- public function testOnCalendarObjectCreateAllDayWithoutTimezone(): void {
+ public function testOnCalendarObjectCreateAllDayWithNullTimezone(): void {
$objectData = [
'calendardata' => self::CALENDAR_DATA_ALL_DAY,
'id' => '42',
@@ -454,6 +454,33 @@ EOD;
$this->reminderService->onCalendarObjectCreate($objectData);
}
+ public function testOnCalendarObjectCreateAllDayWithBlankTimezone(): void {
+ $objectData = [
+ 'calendardata' => self::CALENDAR_DATA_ALL_DAY,
+ 'id' => '42',
+ 'calendarid' => '1337',
+ 'component' => 'vevent',
+ ];
+ $this->timeFactory->expects($this->once())
+ ->method('getDateTime')
+ ->with()
+ ->willReturn(DateTime::createFromFormat(DateTime::ATOM, '2023-02-03T13:28:00+00:00'));
+ $this->caldavBackend->expects(self::once())
+ ->method('getCalendarById')
+ ->with(1337)
+ ->willReturn([
+ '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => '',
+ ]);
+
+ // One hour before midnight relative to the server's time
+ $expectedReminderTimstamp = (new DateTime('2023-02-03T23:00:00'))->getTimestamp();
+ $this->backend->expects(self::once())
+ ->method('insertReminder')
+ ->with(1337, 42, self::anything(), false, 1675468800, false, self::anything(), self::anything(), 'EMAIL', true, $expectedReminderTimstamp, false);
+
+ $this->reminderService->onCalendarObjectCreate($objectData);
+ }
+
public function testOnCalendarObjectCreateAllDayWithTimezone(): void {
$objectData = [
'calendardata' => self::CALENDAR_DATA_ALL_DAY,