Change filters into functions

This commit is contained in:
Oliver Davies 2019-12-27 13:56:51 +00:00
parent 7955042ec0
commit 1c3d7f820f
4 changed files with 39 additions and 90 deletions

View file

@ -50,43 +50,7 @@ class RetrievingEventsTest extends TestCase
];
$talks = $this->extension->getAllTalks([$talkA, $talkB]);
$events = $this->extension->filterPastEvents($talks);
$this->assertInstanceOf(Collection::class, $talks);
$this->assertInstanceOf(Collection::class, $events);
$this->assertCount(2, $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->getAllTalks([$talkA, $talkB]);
$events = $this->extension->filterUpcomingEvents($talks);
$events = $this->extension->getPastEvents($talks);
$this->assertInstanceOf(Collection::class, $talks);
$this->assertInstanceOf(Collection::class, $events);