|
1 | 1 | <?php namespace tests\unit\Query; |
2 | 2 |
|
| 3 | +use Illuminate\Database\Eloquent\Collection; |
3 | 4 | use tests\TestCase; |
4 | 5 |
|
5 | | -use Illuminate\Pagination\Paginator; |
6 | 6 | use Mockery as m; |
7 | 7 | use ZendSearch\Lucene\Search\Query\Boolean; |
8 | 8 |
|
@@ -124,19 +124,27 @@ public function testAddFilter() |
124 | 124 | public function testPaginate() |
125 | 125 | { |
126 | 126 | $query = $this->constructor->query('test'); |
127 | | - $this->runner->shouldReceive('models')->with($this->query, ['limit' => 2, 'offset' => 0])->andReturn([1, 2])->byDefault(); |
| 127 | + $this->runner->shouldReceive('models') |
| 128 | + ->with($this->query, ['limit' => 2, 'offset' => 0]) |
| 129 | + ->andReturn(Collection::make([1, 2]))->byDefault(); |
128 | 130 |
|
129 | 131 | $expected = App::make('paginator')->make([1, 2], 3, 2); |
130 | 132 | $actual = $query->paginate(2); |
131 | 133 |
|
132 | 134 | $this->assertEquals($expected, $actual); |
133 | 135 |
|
134 | | - $this->runner->shouldReceive('models')->with($this->query, ['limit' => 2, 'offset' => 2])->andReturn([1, 2])->byDefault(); |
| 136 | + $this->runner->shouldReceive('models') |
| 137 | + ->with($this->query, ['limit' => 2, 'offset' => 2]) |
| 138 | + ->andReturn(Collection::make([1, 2]))->byDefault(); |
| 139 | + |
135 | 140 | $actual = $query->paginate(2, 2); |
136 | 141 |
|
137 | 142 | $this->assertEquals($expected, $actual); |
138 | 143 |
|
139 | | - $this->runner->shouldReceive('models')->with($this->query, ['limit' => 2, 'offset' => 2])->andReturn([1, 2])->byDefault(); |
| 144 | + $this->runner->shouldReceive('models') |
| 145 | + ->with($this->query, ['limit' => 2, 'offset' => 2]) |
| 146 | + ->andReturn(Collection::make([1, 2]))->byDefault(); |
| 147 | + |
140 | 148 | $actual = $query->paginate(2, function () { return 2; }); |
141 | 149 |
|
142 | 150 | $this->assertEquals($expected, $actual); |
|
0 commit comments