@@ -1944,46 +1944,64 @@ public function testUnshare(): void {
19441944
19451945 }
19461946
1947- public function testDefaultAlarmProperties (): void {
1947+ public function testDefaultAlarmsProperties (): void {
19481948 $ calendarId = $ this ->createTestCalendar ();
19491949
1950- // Test setting both default alarm properties
1950+ $ partDayProperty = '{http://nextcloud.com/ns}default-alarms-part-day ' ;
1951+ $ fullDayProperty = '{http://nextcloud.com/ns}default-alarms-full-day ' ;
1952+
1953+ $ partDayJson = json_encode ([
1954+ ['trigger ' => -86400 , 'action ' => 'EMAIL ' ],
1955+ ['trigger ' => -900 , 'action ' => 'DISPLAY ' ],
1956+ ], JSON_THROW_ON_ERROR );
1957+ $ fullDayJson = json_encode ([
1958+ ['trigger ' => -3600 , 'action ' => 'EMAIL ' ],
1959+ ], JSON_THROW_ON_ERROR );
1960+
1961+ // Set plural default-alarms properties
19511962 $ patch = new PropPatch ([
1952- ' {http://nextcloud.com/ns}default-alarm-part-day ' => - 900 ,
1953- ' {http://nextcloud.com/ns}default-alarm-full-day ' => - 3600 ,
1963+ $ partDayProperty => $ partDayJson ,
1964+ $ fullDayProperty => $ fullDayJson ,
19541965 ]);
19551966 $ this ->backend ->updateCalendar ($ calendarId , $ patch );
19561967 $ patch ->commit ();
19571968
1958- // Verify the properties were set
19591969 $ calendars = $ this ->backend ->getCalendarsForUser (self ::UNIT_TEST_USER );
19601970 $ this ->assertCount (1 , $ calendars );
1961- $ this ->assertEquals (-900 , $ calendars [0 ]['{http://nextcloud.com/ns}default-alarm-part-day ' ]);
1962- $ this ->assertEquals (-3600 , $ calendars [0 ]['{http://nextcloud.com/ns}default-alarm-full-day ' ]);
1963-
1964- // Test updating to different values
1971+ $ this ->assertEquals ($ partDayJson , $ calendars [0 ][$ partDayProperty ]);
1972+ $ this ->assertEquals ($ fullDayJson , $ calendars [0 ][$ fullDayProperty ]);
1973+ $ this ->assertArrayNotHasKey ('{http://nextcloud.com/ns}default-alarm-part-day ' , $ calendars [0 ]);
1974+ $ this ->assertArrayNotHasKey ('{http://nextcloud.com/ns}default-alarm-full-day ' , $ calendars [0 ]);
1975+
1976+ // Update to different values
1977+ $ updatedPartDayJson = json_encode ([
1978+ ['trigger ' => -1800 , 'action ' => 'DISPLAY ' ],
1979+ ], JSON_THROW_ON_ERROR );
1980+ $ updatedFullDayJson = json_encode ([
1981+ ['trigger ' => -43200 , 'action ' => 'DISPLAY ' ],
1982+ ], JSON_THROW_ON_ERROR );
19651983 $ patch = new PropPatch ([
1966- ' {http://nextcloud.com/ns}default-alarm-part-day ' => - 86400 ,
1967- ' {http://nextcloud.com/ns}default-alarm-full-day ' => - 43200 ,
1984+ $ partDayProperty => $ updatedPartDayJson ,
1985+ $ fullDayProperty => $ updatedFullDayJson ,
19681986 ]);
19691987 $ this ->backend ->updateCalendar ($ calendarId , $ patch );
19701988 $ patch ->commit ();
19711989
19721990 $ calendars = $ this ->backend ->getCalendarsForUser (self ::UNIT_TEST_USER );
1973- $ this ->assertEquals (- 86400 , $ calendars [0 ][' {http://nextcloud.com/ns}default-alarm-part-day ' ]);
1974- $ this ->assertEquals (- 43200 , $ calendars [0 ][' {http://nextcloud.com/ns}default-alarm-full-day ' ]);
1991+ $ this ->assertEquals ($ updatedPartDayJson , $ calendars [0 ][$ partDayProperty ]);
1992+ $ this ->assertEquals ($ updatedFullDayJson , $ calendars [0 ][$ fullDayProperty ]);
19751993
1976- // Test setting to null
1994+ // Clear properties
19771995 $ patch = new PropPatch ([
1978- ' {http://nextcloud.com/ns}default-alarm-part-day ' => null ,
1979- ' {http://nextcloud.com/ns}default-alarm-full-day ' => null ,
1996+ $ partDayProperty => null ,
1997+ $ fullDayProperty => null ,
19801998 ]);
19811999 $ this ->backend ->updateCalendar ($ calendarId , $ patch );
19822000 $ patch ->commit ();
19832001
19842002 $ calendars = $ this ->backend ->getCalendarsForUser (self ::UNIT_TEST_USER );
1985- $ this ->assertNull ($ calendars [0 ][' {http://nextcloud.com/ns}default-alarm-part-day ' ]);
1986- $ this ->assertNull ($ calendars [0 ][' {http://nextcloud.com/ns}default-alarm-full-day ' ]);
2003+ $ this ->assertNull ($ calendars [0 ][$ partDayProperty ]);
2004+ $ this ->assertNull ($ calendars [0 ][$ fullDayProperty ]);
19872005
19882006 // Clean up
19892007 $ this ->backend ->deleteCalendar ($ calendars [0 ]['id ' ], true );
0 commit comments