Rename getTalks function

This commit is contained in:
Oliver Davies 2019-12-27 12:42:05 +00:00
parent d57b8ccae0
commit 7955042ec0
4 changed files with 10 additions and 10 deletions

View file

@ -29,7 +29,7 @@ class TalksExtension extends AbstractExtension
public function getFunctions()
{
return [
new TwigFunction('getTalks', [$this, 'getTalks']),
new TwigFunction('get_all_talks', [$this, 'getAllTalks']),
];
}
@ -58,7 +58,7 @@ class TalksExtension extends AbstractExtension
*
* @return Collection A sorted collection of talks.
*/
public function getTalks($talks): Collection
public function getAllTalks($talks): Collection
{
return (new Collection($talks))->sortBy(function ($talk) {
return $this->getLastDate($talk);

View file

@ -49,7 +49,7 @@ class RetrievingEventsTest extends TestCase
],
];
$talks = $this->extension->getTalks([$talkA, $talkB]);
$talks = $this->extension->getAllTalks([$talkA, $talkB]);
$events = $this->extension->filterPastEvents($talks);
$this->assertInstanceOf(Collection::class, $talks);
@ -85,7 +85,7 @@ class RetrievingEventsTest extends TestCase
];
$talks = $this->extension->getTalks([$talkA, $talkB]);
$talks = $this->extension->getAllTalks([$talkA, $talkB]);
$events = $this->extension->filterUpcomingEvents($talks);
$this->assertInstanceOf(Collection::class, $talks);

View file

@ -40,7 +40,7 @@ class RetrievingTalksTest extends TestCase
],
];
$this->assertCount(2, $this->extension->getTalks([$talkA, $talkB]));
$this->assertCount(2, $this->extension->getAllTalks([$talkA, $talkB]));
}
/** @test */
@ -69,7 +69,7 @@ class RetrievingTalksTest extends TestCase
];
$unorderedTalks = [$talkC, $talkA, $talkB];
$orderedTalks = $this->extension->getTalks($unorderedTalks);
$orderedTalks = $this->extension->getAllTalks($unorderedTalks);
$this->assertEquals([$talkC, $talkA, $talkB], $orderedTalks->toArray());
}
@ -91,7 +91,7 @@ class RetrievingTalksTest extends TestCase
],
];
$talks = $this->extension->getTalks([$pastTalk, $futureTalk]);
$talks = $this->extension->getAllTalks([$pastTalk, $futureTalk]);
$filtered = $this->extension->filterPastTalks($talks);
$this->assertCount(1, $filtered);
@ -122,7 +122,7 @@ class RetrievingTalksTest extends TestCase
],
];
$talks = $this->extension->getTalks([$pastTalk, $todayTalk, $futureTalk]);
$talks = $this->extension->getAllTalks([$pastTalk, $todayTalk, $futureTalk]);
$filtered = $this->extension->filterUpcomingTalks($talks);
$this->assertSame(2, $filtered->count());
@ -140,7 +140,7 @@ class RetrievingTalksTest extends TestCase
],
];
$talks = $this->extension->getTalks([$talk]);
$talks = $this->extension->getAllTalks([$talk]);
$this->assertCount(1, $this->extension->filterUpcomingTalks($talks));
$this->assertEmpty($this->extension->filterPastTalks($talks));

View file

@ -24,7 +24,7 @@ talks:
date: 2018-06-27
---
{% block content %}
{% set talks = getTalks(page.talks|merge(data.talks)) %}
{% set talks = get_all_talks(page.talks|merge(data.talks)) %}
<header>
<p class="lead">