Skip to content

Commit fe59bc8

Browse files
committed
Adding test case for combination of event exception and override, which currently fails
1 parent 1dec33b commit fe59bc8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/integration/GregTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,4 +449,33 @@ public function test_next_month_query_string_with_category() {
449449
Greg\next_month_query_string()
450450
);
451451
}
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+
}
452481
}

0 commit comments

Comments
 (0)