Update tests

This commit is contained in:
Oliver Davies 2019-01-16 21:55:42 +00:00
parent f6bf82a15e
commit 0b75d553e9

View file

@ -22,10 +22,8 @@ class FormatTalksTest extends TestCase
$this->extension = new TalksExtension(); $this->extension = new TalksExtension();
} }
/** /** @test */
* @covers \TalksBundle\TwigExtension\TalksExtension::format() public function format_events()
*/
public function testFormat()
{ {
$event_data = [ $event_data = [
'event-a' => [ 'event-a' => [
@ -97,10 +95,8 @@ class FormatTalksTest extends TestCase
}); });
} }
/** /** @test */
* @covers \TalksBundle\TwigExtension\TalksExtension::getAll() public function get_all_events()
*/
public function testGetAll()
{ {
$eventA = ['date' => (new DateTime('+1 week'))->format('Y-m-d')]; $eventA = ['date' => (new DateTime('+1 week'))->format('Y-m-d')];
$eventB = ['date' => (new DateTime('-2 weeks'))->format('Y-m-d')]; $eventB = ['date' => (new DateTime('-2 weeks'))->format('Y-m-d')];
@ -122,10 +118,8 @@ class FormatTalksTest extends TestCase
); );
} }
/** /** @test */
* @covers \TalksBundle\TwigExtension\TalksExtension::getUpcoming() public function get_upcoming_events()
*/
public function testGetUpcoming()
{ {
$eventA = ['date' => (new DateTime('+1 week'))->format('Y-m-d')]; $eventA = ['date' => (new DateTime('+1 week'))->format('Y-m-d')];
$eventB = ['date' => (new DateTime('-2 weeks'))->format('Y-m-d')]; $eventB = ['date' => (new DateTime('-2 weeks'))->format('Y-m-d')];
@ -149,10 +143,8 @@ class FormatTalksTest extends TestCase
); );
} }
/** /** @test */
* @covers \TalksBundle\TwigExtension\TalksExtension::getPast() public function get_past_events()
*/
public function testGetPast()
{ {
$eventA = ['date' => (new DateTime('+1 week'))->format('Y-m-d')]; $eventA = ['date' => (new DateTime('+1 week'))->format('Y-m-d')];
$eventB = ['date' => (new DateTime('-2 weeks'))->format('Y-m-d')]; $eventB = ['date' => (new DateTime('-2 weeks'))->format('Y-m-d')];
@ -178,13 +170,6 @@ class FormatTalksTest extends TestCase
); );
} }
/**
* Extract the returned dates from the results.
*
* @param Collection $results The results returned from the filter.
*
* @return array An array of dates.
*/
private function extractDates(Collection $results) private function extractDates(Collection $results)
{ {
return $results->pluck('event.date')->all(); return $results->pluck('event.date')->all();