Skip to content

Commit 35d35c8

Browse files
committed
add test to confirm
1 parent 46f8a07 commit 35d35c8

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

tests/Tags/EventsTest.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,34 @@
214214
expect($pagination['paginate']['next_page'])->toEqual('/events?page=2');
215215
});
216216

217+
test('can paginate between occurrences', function () {
218+
Carbon::setTestNow(now()->setTimeFromTimeString('10:00'));
219+
220+
$this->tag
221+
->setContext([])
222+
->setParameters([
223+
'collection' => 'events',
224+
'from' => now()->subDay(),
225+
'to' => now()->addWeeks(4),
226+
'paginate' => 2,
227+
]);
228+
229+
Cascade::partialMock()->shouldReceive('get')
230+
->with('uri')
231+
->andReturn('/events');
232+
233+
$pagination = $this->tag->between();
234+
235+
expect($pagination)
236+
->toHaveKey('results')
237+
->toHaveKey('paginate')
238+
->toHaveKey('total_results');
239+
240+
expect($pagination['results'])->toHaveCount(2);
241+
expect($pagination['total_results'])->toEqual(2);
242+
expect($pagination['paginate']['next_page'])->toEqual('/events?page=2');
243+
});
244+
217245
test('can generate upcoming occurrences with taxonomy terms', function () {
218246
Carbon::setTestNow(now()->setTimeFromTimeString('10:00'));
219247

@@ -274,7 +302,7 @@
274302
->first()->title->toBe('Single Event');
275303
});
276304

277-
test('can generate upcoming occurrences with filter', function () {
305+
test('can generate between occurrences with filter', function () {
278306
Carbon::setTestNow(now()->setTimeFromTimeString('10:00'));
279307

280308
Entry::make()

0 commit comments

Comments
 (0)