Skip to content

Commit

Permalink
Add functions to create inactive events
Browse files Browse the repository at this point in the history
  • Loading branch information
psrpinto committed Feb 22, 2024
1 parent e775447 commit a084cda
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/lib/event-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ public function create_active( array $attendee_ids = array() ): int {
);
}

public function create_inactive_past( array $attendee_ids = array() ): int {
$now = new DateTimeImmutable( 'now', new DateTimeZone( 'UTC' ) );

return $this->create_event(
$now->modify( '-2 hours' ),
$now->modify( '-1 hours' ),
$attendee_ids
);
}

public function create_inactive_future( array $attendee_ids = array() ): int {
$now = new DateTimeImmutable( 'now', new DateTimeZone( 'UTC' ) );

return $this->create_event(
$now->modify( '+1 hours' ),
$now->modify( '+2 hours' ),
$attendee_ids
);
}

private function create_event( DateTimeImmutable $start, DateTimeImmutable $end, array $attendee_ids ): int {
$event_id = $this->create();

Expand Down

0 comments on commit a084cda

Please sign in to comment.