public function getPaginator($firstResult = 1, $maxResults = 15, $totalItems = 42)
{
$query = $this->prophesize(Query::class);
$query->getFirstResult()->willReturn($firstResult)->shouldBeCalled();
$query->getMaxResults()->willReturn($maxResults)->shouldBeCalled();
$doctrinePaginator = $this->prophesize(DoctrinePaginator::class);
$doctrinePaginator->getQuery()->willReturn($query->reveal())->shouldBeCalled();
$doctrinePaginator->count()->willReturn($totalItems)->shouldBeCalled();
$doctrinePaginator->getIterator()->will(function () {
return new \ArrayIterator();
});
return new Paginator($doctrinePaginator->reveal());
}