forked from laravel/scout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuilderTest.php
32 lines (26 loc) · 915 Bytes
/
BuilderTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
namespace Tests;
use Mockery;
use StdClass;
use Laravel\Scout\Builder;
use Illuminate\Pagination\Paginator;
use Illuminate\Database\Eloquent\Collection;
class BuilderTest extends AbstractTestCase
{
public function test_pagination_correctly_handles_paginated_results()
{
Paginator::currentPageResolver(function () {
return 1;
});
Paginator::currentPathResolver(function () {
return 'http://localhost/foo';
});
$builder = new Builder($model = Mockery::mock(), 'zonda');
$model->shouldReceive('getPerPage')->andReturn(15);
$model->shouldReceive('searchableUsing')->andReturn($engine = Mockery::mock());
$engine->shouldReceive('paginate');
$engine->shouldReceive('map')->andReturn(Collection::make([new StdClass]));
$engine->shouldReceive('getTotalCount');
$builder->paginate();
}
}