public function testQueryPagerExtension()
{
$mapper = test_spot_mapper();
\Spot\Query::addMethod('page', function (\Spot\Query $query, $limit, $perPage = 20) {
return $query->limit($limit, $perPage);
});
$posts = $mapper->all('\\Spot\\Entity\\Post')->page(1, 1);
// Do this instead of $posts->count() because it drops LIMIT clause to count the full dataset
$postCount = count($posts->toArray());
$this->assertEquals(1, $postCount);
}