@@ -449,4 +449,33 @@ public function test_next_month_query_string_with_category() {
449
449
Greg \next_month_query_string ()
450
450
);
451
451
}
452
+
453
+ public function test_get_events_with_recurrences_overrides_and_exceptions () {
454
+ $ this ->factory ->post ->create ([
455
+ 'post_type ' => 'greg_event ' ,
456
+ 'post_title ' => 'My Recurring Event with Override and Exception ' ,
457
+ 'meta_input ' => [
458
+ 'greg_start ' => '2022-12-17 10:00:00 ' ,
459
+ 'greg_end ' => '2022-12-17 11:00:00 ' ,
460
+ 'greg_frequency ' => 'WEEKLY ' ,
461
+ 'greg_until ' => '2023-01-02 10:00:00 ' ,
462
+ 'greg_exceptions ' => ['2022-12-25 13:00:00 ' ],
463
+ 'greg_overrides ' => [
464
+ ['BYDAY ' => ['SA ' ], 'start ' => '10:00:00 ' , 'end ' => '11:00:00 ' ],
465
+ ['BYDAY ' => ['SU ' ], 'start ' => '13:00:00 ' , 'end ' => '14:00:00 ' ],
466
+ ],
467
+ ],
468
+ ]);
469
+
470
+ $ events = Greg \get_events ([
471
+ 'current_time ' => '2022-12-16 ' ,
472
+ ]);
473
+
474
+ $ this ->assertCount (4 , $ events );
475
+ foreach ($ events as $ event ) {
476
+ $ this ->assertInstanceOf (Event::class, $ event );
477
+ $ this ->assertEquals ('My Recurring Event with Override and Exception ' , $ event ->title ());
478
+ $ this ->assertNotEquals ('2022-12-25 ' , $ event ->start ('Y-m-d ' ));
479
+ }
480
+ }
452
481
}
0 commit comments