I have the following tests
public function testReturnsDifferenceInRows()
{
$eventDate = factory(EventDate::class)->create([
'id' => 3,
'date_from' => Carbon::now(),
'date_until' => Carbon::now()->addDay(5),
'time_from' => '08:00',
'time_until' => '08:00'
]);
$this->assertEquals(6, $eventDate->recurring->count());
}
public function testReturnsDifferenceInRowsOverlapUntilTime()
{
$eventDate = factory(EventDate::class)->create([
'id' => 3,
'date_from' => Carbon::now(),
'date_until' => Carbon::now()->addDay(5),
'time_from' => '08:00',
'time_until' => '02:00'
]);
$this->assertEquals(6, $eventDate->recurring->count());
}
public function testReturnsDifferenceInRowsOverlapMidnight()
{
$eventDate = factory(EventDate::class)->create([
'id' => 3,
'date_from' => Carbon::now(),
'date_until' => Carbon::now()->addDay(5),
'time_from' => '23:00',
'time_until' => '02:00'
]);
$this->assertEquals(6, $eventDate->recurring->count());
}
As you can see I use almost exactly the same data, the only variables here are the
time_from and time_until.
How can I rewrite this as to reuse the other data?