@@ -2081,52 +2081,70 @@ public function testUnshare(): void {
20812081
20822082 }
20832083
2084- public function testDefaultAlarmProperties (): void {
2084+ public function testDefaultAlarmsProperties (): void {
20852085 $ calendarId = $ this ->createTestCalendar ();
20862086
2087- // Test setting both default alarm properties
2087+ $ partDayProperty = '{http://nextcloud.com/ns}default-alarms-part-day ' ;
2088+ $ fullDayProperty = '{http://nextcloud.com/ns}default-alarms-full-day ' ;
2089+
2090+ $ partDayJson = json_encode ([
2091+ ['trigger ' => -86400 , 'action ' => 'EMAIL ' ],
2092+ ['trigger ' => -900 , 'action ' => 'DISPLAY ' ],
2093+ ], JSON_THROW_ON_ERROR );
2094+ $ fullDayJson = json_encode ([
2095+ ['trigger ' => -3600 , 'action ' => 'EMAIL ' ],
2096+ ], JSON_THROW_ON_ERROR );
2097+
2098+ // Set plural default-alarms properties
20882099 $ patch = new PropPatch ([
2089- ' {http://nextcloud.com/ns}default-alarm-part-day ' => - 900 ,
2090- ' {http://nextcloud.com/ns}default-alarm-full-day ' => - 3600 ,
2100+ $ partDayProperty => $ partDayJson ,
2101+ $ fullDayProperty => $ fullDayJson ,
20912102 ]);
20922103 $ this ->backend ->updateCalendar ($ calendarId , $ patch );
20932104 $ patch ->commit ();
20942105
2095- // Verify the properties were set
20962106 $ calendars = $ this ->backend ->getCalendarsForUser (self ::UNIT_TEST_USER );
20972107 $ this ->assertCount (1 , $ calendars );
2098- $ this ->assertEquals (-900 , $ calendars [0 ]['{http://nextcloud.com/ns}default-alarm-part-day ' ]);
2099- $ this ->assertEquals (-3600 , $ calendars [0 ]['{http://nextcloud.com/ns}default-alarm-full-day ' ]);
2100-
2101- // Test updating to different values
2108+ $ this ->assertEquals ($ partDayJson , $ calendars [0 ][$ partDayProperty ]);
2109+ $ this ->assertEquals ($ fullDayJson , $ calendars [0 ][$ fullDayProperty ]);
2110+ $ this ->assertArrayNotHasKey ('{http://nextcloud.com/ns}default-alarm-part-day ' , $ calendars [0 ]);
2111+ $ this ->assertArrayNotHasKey ('{http://nextcloud.com/ns}default-alarm-full-day ' , $ calendars [0 ]);
2112+
2113+ // Update to different values
2114+ $ updatedPartDayJson = json_encode ([
2115+ ['trigger ' => -1800 , 'action ' => 'DISPLAY ' ],
2116+ ], JSON_THROW_ON_ERROR );
2117+ $ updatedFullDayJson = json_encode ([
2118+ ['trigger ' => -43200 , 'action ' => 'DISPLAY ' ],
2119+ ], JSON_THROW_ON_ERROR );
21022120 $ patch = new PropPatch ([
2103- ' {http://nextcloud.com/ns}default-alarm-part-day ' => - 86400 ,
2104- ' {http://nextcloud.com/ns}default-alarm-full-day ' => - 43200 ,
2121+ $ partDayProperty => $ updatedPartDayJson ,
2122+ $ fullDayProperty => $ updatedFullDayJson ,
21052123 ]);
21062124 $ this ->backend ->updateCalendar ($ calendarId , $ patch );
21072125 $ patch ->commit ();
21082126
21092127 $ calendars = $ this ->backend ->getCalendarsForUser (self ::UNIT_TEST_USER );
2110- $ this ->assertEquals (- 86400 , $ calendars [0 ][' {http://nextcloud.com/ns}default-alarm-part-day ' ]);
2111- $ this ->assertEquals (- 43200 , $ calendars [0 ][' {http://nextcloud.com/ns}default-alarm-full-day ' ]);
2128+ $ this ->assertEquals ($ updatedPartDayJson , $ calendars [0 ][$ partDayProperty ]);
2129+ $ this ->assertEquals ($ updatedFullDayJson , $ calendars [0 ][$ fullDayProperty ]);
21122130
2113- // Test setting to null
2131+ // Clear properties
21142132 $ patch = new PropPatch ([
2115- ' {http://nextcloud.com/ns}default-alarm-part-day ' => null ,
2116- ' {http://nextcloud.com/ns}default-alarm-full-day ' => null ,
2133+ $ partDayProperty => null ,
2134+ $ fullDayProperty => null ,
21172135 ]);
21182136 $ this ->backend ->updateCalendar ($ calendarId , $ patch );
21192137 $ patch ->commit ();
21202138
21212139 $ calendars = $ this ->backend ->getCalendarsForUser (self ::UNIT_TEST_USER );
2122- $ this ->assertNull ($ calendars [0 ][' {http://nextcloud.com/ns}default-alarm-part-day ' ]);
2123- $ this ->assertNull ($ calendars [0 ][' {http://nextcloud.com/ns}default-alarm-full-day ' ]);
2140+ $ this ->assertNull ($ calendars [0 ][$ partDayProperty ]);
2141+ $ this ->assertNull ($ calendars [0 ][$ fullDayProperty ]);
21242142
21252143 // Clean up
21262144 $ this ->backend ->deleteCalendar ($ calendars [0 ]['id ' ], true );
21272145 }
21282146
2129- public function testSearchPrincipalWithTimeRange (): void {
2147+ public function testSearchPrincipalWithTimeRange (): void {
21302148 $ myPublic = <<<EOD
21312149BEGIN:VCALENDAR
21322150VERSION:2.0
0 commit comments