We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| @@ 72-85 (lines=14) @@ | ||
| 69 | $this->assertTrue($result->pageInfo->hasNextPage); |
|
| 70 | } |
|
| 71 | ||
| 72 | public function testForwardAfterInMiddle() |
|
| 73 | { |
|
| 74 | $paginator = new Paginator(function ($offset, $limit) { |
|
| 75 | $this->assertSame(2, $offset); |
|
| 76 | $this->assertSame(3, $limit); // Includes the extra element to check if next page is available |
|
| 77 | ||
| 78 | return $this->getData($offset); |
|
| 79 | }); |
|
| 80 | ||
| 81 | $result = $paginator->forward(new Argument(['first' => 1, 'after' => base64_encode('arrayconnection:2')])); |
|
| 82 | ||
| 83 | $this->assertCount(1, $result->edges); |
|
| 84 | $this->assertSameEdgeNodeValue(['D'], $result); |
|
| 85 | $this->assertTrue($result->pageInfo->hasNextPage); |
|
| 86 | } |
|
| 87 | ||
| 88 | public function testForwardAfterAtTheEnd() |
|
| @@ 88-101 (lines=14) @@ | ||
| 85 | $this->assertTrue($result->pageInfo->hasNextPage); |
|
| 86 | } |
|
| 87 | ||
| 88 | public function testForwardAfterAtTheEnd() |
|
| 89 | { |
|
| 90 | $paginator = new Paginator(function ($offset, $limit) { |
|
| 91 | $this->assertSame(2, $offset); |
|
| 92 | $this->assertSame(4, $limit); // Includes the extra element to check if next page is available |
|
| 93 | ||
| 94 | return $this->getData($offset); |
|
| 95 | }); |
|
| 96 | ||
| 97 | $result = $paginator->forward(new Argument(['first' => 2, 'after' => base64_encode('arrayconnection:2')])); |
|
| 98 | ||
| 99 | $this->assertCount(2, $result->edges); |
|
| 100 | $this->assertSameEdgeNodeValue(['D', 'E'], $result); |
|
| 101 | $this->assertFalse($result->pageInfo->hasNextPage); |
|
| 102 | } |
|
| 103 | ||
| 104 | public function testForwardAfterLast() |
|
| @@ 104-117 (lines=14) @@ | ||
| 101 | $this->assertFalse($result->pageInfo->hasNextPage); |
|
| 102 | } |
|
| 103 | ||
| 104 | public function testForwardAfterLast() |
|
| 105 | { |
|
| 106 | $paginator = new Paginator(function ($offset, $limit) { |
|
| 107 | $this->assertSame(4, $offset); |
|
| 108 | $this->assertSame(7, $limit); // Includes the extra element to check if next page is available |
|
| 109 | ||
| 110 | return $this->getData($offset); |
|
| 111 | }); |
|
| 112 | ||
| 113 | $result = $paginator->forward(new Argument(['first' => 5, 'after' => base64_encode('arrayconnection:4')])); |
|
| 114 | ||
| 115 | $this->assertCount(0, $result->edges); |
|
| 116 | $this->assertSameEdgeNodeValue([], $result); |
|
| 117 | $this->assertFalse($result->pageInfo->hasNextPage); |
|
| 118 | } |
|
| 119 | ||
| 120 | public function testForwardAfterWithUnvalidCursorAndSlice() |
|