refactor: Remove the sortable_date for talks

Automatically calculate the sortable date for a talk using the event
dates. This means that the `sortable_date` in the YAML front matter can
be removed.

Fixes #4
This commit is contained in:
Oliver Davies 2021-09-08 23:47:14 +01:00
parent 42e0ae1297
commit efbd099515
36 changed files with 30 additions and 34 deletions

View file

@ -107,4 +107,24 @@ final class TalkExtensionTest extends TestCase
$this->assertSame(1, $this->subject->getPastTalkCount($talks));
}
/** @test */
public function should_get_the_last_event_date_for_a_talk(): void
{
$talkA = [
'events' => [
['date' => '2015-10-14'],
['date' => '2021-09-07'],
['date' => '2021-08-19'],
],
];
$talkB = [
'events' => [],
];
$this->assertSame('2021-09-07', $this->subject->getLastEventDate($talkA));
$this->assertNull($this->subject->getLastEventDate($talkB));
}
}