|
1 | 1 | <?php |
| 2 | +declare(strict_types=1); |
| 3 | + |
2 | 4 | namespace BryanCrowe\ApiPagination\Test; |
3 | 5 |
|
4 | 6 | use BryanCrowe\ApiPagination\Controller\Component\ApiPaginationComponent; |
5 | 7 | use BryanCrowe\ApiPagination\TestApp\Controller\ArticlesController; |
6 | 8 | use Cake\Event\Event; |
7 | 9 | use Cake\Http\ServerRequest as Request; |
8 | | -use Cake\Http\Response; |
9 | 10 | use Cake\ORM\TableRegistry; |
10 | 11 | use Cake\TestSuite\TestCase; |
11 | 12 |
|
@@ -108,15 +109,16 @@ public function testVisibilitySettings() |
108 | 109 | ); |
109 | 110 | $this->controller->set('data', $this->controller->paginate($this->Articles)); |
110 | 111 | $apiPaginationComponent = new ApiPaginationComponent( |
111 | | - $this->controller->components(), [ |
| 112 | + $this->controller->components(), |
| 113 | + [ |
112 | 114 | 'visible' => [ |
113 | 115 | 'page', |
114 | 116 | 'current', |
115 | 117 | 'count', |
116 | 118 | 'prevPage', |
117 | 119 | 'nextPage', |
118 | | - 'pageCount' |
119 | | - ] |
| 120 | + 'pageCount', |
| 121 | + ], |
120 | 122 | ] |
121 | 123 | ); |
122 | 124 | $event = new Event('Controller.beforeRender', $this->controller); |
@@ -147,12 +149,13 @@ public function testAliasSettings() |
147 | 149 | ); |
148 | 150 | $this->controller->set('data', $this->controller->paginate($this->Articles)); |
149 | 151 | $apiPaginationComponent = new ApiPaginationComponent( |
150 | | - $this->controller->components(), [ |
| 152 | + $this->controller->components(), |
| 153 | + [ |
151 | 154 | 'aliases' => [ |
152 | 155 | 'page' => 'curPage', |
153 | 156 | 'current' => 'currentCount', |
154 | 157 | 'count' => 'totalCount', |
155 | | - ] |
| 158 | + ], |
156 | 159 | ] |
157 | 160 | ); |
158 | 161 | $event = new Event('Controller.beforeRender', $this->controller); |
@@ -195,8 +198,9 @@ public function testKeySetting() |
195 | 198 | ); |
196 | 199 | $this->controller->set('data', $this->controller->paginate($this->Articles)); |
197 | 200 | $apiPaginationComponent = new ApiPaginationComponent( |
198 | | - $this->controller->components(), [ |
199 | | - 'key' => 'paging' |
| 201 | + $this->controller->components(), |
| 202 | + [ |
| 203 | + 'key' => 'paging', |
200 | 204 | ] |
201 | 205 | ); |
202 | 206 | $event = new Event('Controller.beforeRender', $this->controller); |
@@ -239,20 +243,21 @@ public function testAllSettings() |
239 | 243 | ); |
240 | 244 | $this->controller->set('data', $this->controller->paginate($this->Articles)); |
241 | 245 | $apiPaginationComponent = new ApiPaginationComponent( |
242 | | - $this->controller->components(), [ |
| 246 | + $this->controller->components(), |
| 247 | + [ |
243 | 248 | 'key' => 'fun', |
244 | 249 | 'aliases' => [ |
245 | 250 | 'page' => 'currentPage', |
246 | 251 | 'count' => 'totalCount', |
247 | | - 'limit' => 'unusedAlias' |
| 252 | + 'limit' => 'unusedAlias', |
248 | 253 | ], |
249 | 254 | 'visible' => [ |
250 | 255 | 'currentPage', |
251 | 256 | 'totalCount', |
252 | 257 | 'limit', |
253 | 258 | 'prevPage', |
254 | | - 'nextPage' |
255 | | - ] |
| 259 | + 'nextPage', |
| 260 | + ], |
256 | 261 | ] |
257 | 262 | ); |
258 | 263 | $event = new Event('Controller.beforeRender', $this->controller); |
|
0 commit comments