3535use DateTimeZone ;
3636use OCA \DAV \CalDAV \CalDavBackend ;
3737use OCA \DAV \CalDAV \Calendar ;
38- use OCA \DAV \Events \CalendarCreatedEvent ;
3938use OCA \DAV \Events \CalendarDeletedEvent ;
40- use OCA \DAV \Events \CalendarObjectCreatedEvent ;
41- use OCA \DAV \Events \CalendarUpdatedEvent ;
4239use OCP \IConfig ;
4340use OCP \IL10N ;
4441use Sabre \DAV \Exception \NotFound ;
@@ -62,11 +59,8 @@ public function testCalendarOperations() {
6259 '{DAV:}displayname ' => 'Unit test ' ,
6360 '{urn:ietf:params:xml:ns:caldav}calendar-description ' => 'Calendar used for unit testing '
6461 ]);
65- $ this ->dispatcher ->expects (self ::once ())
66- ->method ('dispatchTyped ' )
67- ->with (self ::callback (function ($ event ) {
68- return $ event instanceof CalendarUpdatedEvent;
69- }));
62+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
63+ ->method ('dispatchTyped ' );
7064 $ this ->backend ->updateCalendar ($ calendarId , $ patch );
7165 $ patch ->commit ();
7266 $ this ->assertEquals (1 , $ this ->backend ->getCalendarsForUserCount (self ::UNIT_TEST_USER ));
@@ -77,11 +71,8 @@ public function testCalendarOperations() {
7771 $ this ->assertEquals ('User \'s displayname ' , $ calendars [0 ]['{http://nextcloud.com/ns}owner-displayname ' ]);
7872
7973 // delete the address book
80- $ this ->dispatcher ->expects (self ::once ())
81- ->method ('dispatchTyped ' )
82- ->with (self ::callback (function ($ event ) {
83- return $ event instanceof CalendarDeletedEvent;
84- }));
74+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
75+ ->method ('dispatchTyped ' );
8576 $ this ->backend ->deleteCalendar ($ calendars [0 ]['id ' ], true );
8677 $ calendars = $ this ->backend ->getCalendarsForUser (self ::UNIT_TEST_USER );
8778 self ::assertEmpty ($ calendars );
@@ -190,11 +181,8 @@ public function testCalendarSharing($userCanRead, $userCanWrite, $groupCanRead,
190181END:VCALENDAR
191182EOD;
192183
193- $ this ->dispatcher ->expects (self ::once ())
194- ->method ('dispatchTyped ' )
195- ->with (self ::callback (function ($ event ) {
196- return $ event instanceof CalendarObjectCreatedEvent;
197- }));
184+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
185+ ->method ('dispatchTyped ' );
198186 $ this ->backend ->createCalendarObject ($ calendarId , $ uri , $ calData );
199187
200188 /** @var IACL $child */
@@ -238,11 +226,8 @@ public function testCalendarObjectsOperations() {
238226END:VCALENDAR
239227EOD;
240228
241- $ this ->dispatcher ->expects (self ::once ())
242- ->method ('dispatchTyped ' )
243- ->with (self ::callback (function ($ event ) {
244- return $ event instanceof CalendarObjectCreatedEvent;
245- }));
229+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
230+ ->method ('dispatchTyped ' );
246231 $ this ->backend ->createCalendarObject ($ calendarId , $ uri , $ calData );
247232
248233 // get all the cards
@@ -278,21 +263,15 @@ public function testCalendarObjectsOperations() {
278263END:VEVENT
279264END:VCALENDAR
280265EOD;
281- $ this ->dispatcher ->expects (self ::once ())
282- ->method ('dispatchTyped ' )
283- ->with (self ::callback (function ($ event ) {
284- return $ event instanceof CalendarUpdatedEvent;
285- }));
266+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
267+ ->method ('dispatchTyped ' );
286268 $ this ->backend ->updateCalendarObject ($ calendarId , $ uri , $ calData );
287269 $ calendarObject = $ this ->backend ->getCalendarObject ($ calendarId , $ uri );
288270 $ this ->assertEquals ($ calData , $ calendarObject ['calendardata ' ]);
289271
290272 // delete the card
291- $ this ->dispatcher ->expects (self ::once ())
292- ->method ('dispatchTyped ' )
293- ->with (self ::callback (function ($ event ) {
294- return $ event instanceof CalendarDeletedEvent;
295- }));
273+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
274+ ->method ('dispatchTyped ' );
296275 $ this ->backend ->deleteCalendarObject ($ calendarId , $ uri );
297276 $ calendarObjects = $ this ->backend ->getCalendarObjects ($ calendarId );
298277 $ this ->assertCount (0 , $ calendarObjects );
@@ -385,25 +364,16 @@ public function testMultiCalendarObjects() {
385364EOD;
386365
387366 $ uri0 = static ::getUniqueID ('card ' );
388- $ this ->dispatcher ->expects (self ::once ())
389- ->method ('dispatchTyped ' )
390- ->with (self ::callback (function ($ event ) {
391- return $ event instanceof CalendarObjectCreatedEvent;
392- }));
367+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
368+ ->method ('dispatchTyped ' );
393369 $ this ->backend ->createCalendarObject ($ calendarId , $ uri0 , $ calData [0 ]);
394370 $ uri1 = static ::getUniqueID ('card ' );
395- $ this ->dispatcher ->expects (self ::once ())
396- ->method ('dispatchTyped ' )
397- ->with (self ::callback (function ($ event ) {
398- return $ event instanceof CalendarObjectCreatedEvent;
399- }));
371+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
372+ ->method ('dispatchTyped ' );
400373 $ this ->backend ->createCalendarObject ($ calendarId , $ uri1 , $ calData [1 ]);
401374 $ uri2 = static ::getUniqueID ('card ' );
402- $ this ->dispatcher ->expects (self ::once ())
403- ->method ('dispatchTyped ' )
404- ->with (self ::callback (function ($ event ) {
405- return $ event instanceof CalendarObjectCreatedEvent;
406- }));
375+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
376+ ->method ('dispatchTyped ' );
407377 $ this ->backend ->createCalendarObject ($ calendarId , $ uri2 , $ calData [2 ]);
408378
409379 // get all the cards
@@ -430,23 +400,14 @@ public function testMultiCalendarObjects() {
430400 $ this ->assertEquals ($ calData [2 ], $ calendarObjects [1 ]['calendardata ' ]);
431401
432402 // delete the card
433- $ this ->dispatcher ->expects (self ::once ())
434- ->method ('dispatchTyped ' )
435- ->with (self ::callback (function ($ event ) {
436- return $ event instanceof CalendarDeletedEvent;
437- }));
403+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
404+ ->method ('dispatchTyped ' );
438405 $ this ->backend ->deleteCalendarObject ($ calendarId , $ uri0 );
439- $ this ->dispatcher ->expects (self ::once ())
440- ->method ('dispatchTyped ' )
441- ->with (self ::callback (function ($ event ) {
442- return $ event instanceof CalendarDeletedEvent;
443- }));
406+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
407+ ->method ('dispatchTyped ' );
444408 $ this ->backend ->deleteCalendarObject ($ calendarId , $ uri1 );
445- $ this ->dispatcher ->expects (self ::once ())
446- ->method ('dispatchTyped ' )
447- ->with (self ::callback (function ($ event ) {
448- return $ event instanceof CalendarDeletedEvent;
449- }));
409+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
410+ ->method ('dispatchTyped ' );
450411 $ this ->backend ->deleteCalendarObject ($ calendarId , $ uri2 );
451412 $ calendarObjects = $ this ->backend ->getCalendarObjects ($ calendarId );
452413 $ this ->assertCount (0 , $ calendarObjects );
@@ -529,11 +490,8 @@ public function testSyncSupport() {
529490 }
530491
531492 public function testPublications () {
532- $ this ->dispatcher ->expects (self ::once ())
533- ->method ('dispatchTyped ' )
534- ->with (self ::callback (function ($ event ) {
535- return $ event instanceof CalendarCreatedEvent;
536- }));
493+ $ this ->dispatcher ->expects (self ::atLeastOnce ())
494+ ->method ('dispatchTyped ' );
537495
538496 $ this ->backend ->createCalendar (self ::UNIT_TEST_USER , 'Example ' , []);
539497
0 commit comments