We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| @@ 171-184 (lines=14) @@ | ||
| 168 | $this->assertFalse($result->pageInfo->hasNextPage); |
|
| 169 | } |
|
| 170 | ||
| 171 | public function testBackwardBeforeLast() |
|
| 172 | { |
|
| 173 | $paginator = new Paginator(function ($offset, $limit) { |
|
| 174 | $this->assertSame(4, $limit); |
|
| 175 | ||
| 176 | return $this->getData($offset); |
|
| 177 | }); |
|
| 178 | ||
| 179 | $result = $paginator->backward(new Argument(['last' => 4, 'before' => base64_encode('arrayconnection:4')]), 5); |
|
| 180 | ||
| 181 | $this->assertCount(4, $result->edges); |
|
| 182 | $this->assertSameEdgeNodeValue(['A', 'B', 'C', 'D'], $result); |
|
| 183 | $this->assertFalse($result->pageInfo->hasPreviousPage); |
|
| 184 | } |
|
| 185 | ||
| 186 | public function testBackwardPartialBeforeInMiddle() |
|
| 187 | { |
|
| @@ 186-200 (lines=15) @@ | ||
| 183 | $this->assertFalse($result->pageInfo->hasPreviousPage); |
|
| 184 | } |
|
| 185 | ||
| 186 | public function testBackwardPartialBeforeInMiddle() |
|
| 187 | { |
|
| 188 | $paginator = new Paginator(function ($offset, $limit) { |
|
| 189 | $this->assertSame(1, $offset); |
|
| 190 | $this->assertSame(2, $limit); |
|
| 191 | ||
| 192 | return $this->getData($offset); |
|
| 193 | }); |
|
| 194 | ||
| 195 | $result = $paginator->backward(new Argument(['last' => 2, 'before' => base64_encode('arrayconnection:3')]), 5); |
|
| 196 | ||
| 197 | $this->assertCount(2, $result->edges); |
|
| 198 | $this->assertSameEdgeNodeValue(['B', 'C'], $result); |
|
| 199 | $this->assertTrue($result->pageInfo->hasPreviousPage); |
|
| 200 | } |
|
| 201 | ||
| 202 | public function testAutoBackward() |
|
| 203 | { |
|
| @@ 219-233 (lines=15) @@ | ||
| 216 | $this->assertFalse($result->pageInfo->hasNextPage); |
|
| 217 | } |
|
| 218 | ||
| 219 | public function testAutoForward() |
|
| 220 | { |
|
| 221 | $paginator = new Paginator(function ($offset, $limit) { |
|
| 222 | $this->assertSame(0, $offset); |
|
| 223 | $this->assertSame(5, $limit); // Includes the extra element to check if next page is available |
|
| 224 | ||
| 225 | return $this->getData($offset); |
|
| 226 | }); |
|
| 227 | ||
| 228 | $result = $paginator->auto(new Argument(['first' => 4]), 5); |
|
| 229 | ||
| 230 | $this->assertCount(4, $result->edges); |
|
| 231 | $this->assertSameEdgeNodeValue(['A', 'B', 'C', 'D'], $result); |
|
| 232 | $this->assertTrue($result->pageInfo->hasNextPage); |
|
| 233 | } |
|
| 234 | ||
| 235 | public function testAutoBackwardWithCallable() |
|
| 236 | { |
|