Add filters for upcoming and past events
This commit is contained in:
parent
e94ff3addd
commit
394be76029
2 changed files with 100 additions and 10 deletions
|
@ -49,6 +49,80 @@ class RetrievingEventsTest extends TestCase
|
|||
],
|
||||
];
|
||||
|
||||
$this->assertCount(3, $this->extension->getEvents([$talkA, $talkB]));
|
||||
$talks = $this->extension->getTalks([$talkA, $talkB]);
|
||||
$this->assertInstanceOf(Collection::class, $talks);
|
||||
$this->assertCount(3, $this->extension->getEvents($talks));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function get_past_events()
|
||||
{
|
||||
$talkA = [
|
||||
'title' => 'Test Driven Drupal',
|
||||
'events' => [
|
||||
[
|
||||
'event' => 'php_south_wales',
|
||||
'date' => (new DateTime('+1 days'))->getTimestamp(),
|
||||
],
|
||||
[
|
||||
'event' => 'drupalcamp_london',
|
||||
'date' => (new DateTime('-1 days'))->getTimestamp(),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$talkB = [
|
||||
'title' => 'Taking Flight with Tailwind CSS',
|
||||
'events' => [
|
||||
[
|
||||
'event' => 'blue_conf_2019',
|
||||
'date' => (new DateTime('-2 days'))->getTimestamp(),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$talks = $this->extension->getTalks([$talkA, $talkB]);
|
||||
$events = $this->extension->getEvents($talks);
|
||||
|
||||
$this->assertInstanceOf(Collection::class, $talks);
|
||||
$this->assertInstanceOf(Collection::class, $events);
|
||||
|
||||
$this->assertCount(2, $this->extension->filterPastEvents($events));
|
||||
}
|
||||
/** @test */
|
||||
public function get_current_or_upcoming_events()
|
||||
{
|
||||
$talkA = [
|
||||
'title' => 'Test Driven Drupal',
|
||||
'events' => [
|
||||
[
|
||||
'event' => 'php_south_wales',
|
||||
'date' => (new DateTime('+0 days'))->getTimestamp(),
|
||||
],
|
||||
[
|
||||
'event' => 'drupalcamp_london',
|
||||
'date' => (new DateTime('-1 days'))->getTimestamp(),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$talkB = [
|
||||
'title' => 'Taking Flight with Tailwind CSS',
|
||||
'events' => [
|
||||
[
|
||||
'event' => 'blue_conf_2019',
|
||||
'date' => (new DateTime('+2 days'))->getTimestamp(),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
$talks = $this->extension->getTalks([$talkA, $talkB]);
|
||||
$events = $this->extension->getEvents($talks);
|
||||
|
||||
$this->assertInstanceOf(Collection::class, $talks);
|
||||
$this->assertInstanceOf(Collection::class, $events);
|
||||
|
||||
$this->assertCount(2, $this->extension->filterUpcomingEvents($events));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue