Skip to content

Commit 4eec97c

Browse files
author
Mikael Capelle
committed
Fix tests and travis for CakePHP 3.7.
1 parent 2f77320 commit 4eec97c

File tree

3 files changed

+57
-37
lines changed

3 files changed

+57
-37
lines changed

.travis.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ php:
99
dist: trusty
1010

1111
env:
12-
- CAKEPHP_VERSION=3.6.* DEFAULT=1
12+
- CAKEPHP_VERSION=3.7.* DEFAULT=1
1313

1414
matrix:
1515
include:
@@ -29,6 +29,22 @@ matrix:
2929
env: CAKEPHP_VERSION=3.5.0
3030
- php: 7.2
3131
env: CAKEPHP_VERSION=3.5.*
32+
- php: 5.6
33+
env: CAKEPHP_VERSION=3.6.0
34+
- php: 5.6
35+
env: CAKEPHP_VERSION=3.6.*
36+
- php: 7.0
37+
env: CAKEPHP_VERSION=3.6.0
38+
- php: 7.0
39+
env: CAKEPHP_VERSION=3.6.*
40+
- php: 7.1
41+
env: CAKEPHP_VERSION=3.6.0
42+
- php: 7.1
43+
env: CAKEPHP_VERSION=3.6.*
44+
- php: 7.2
45+
env: CAKEPHP_VERSION=3.6.0
46+
- php: 7.2
47+
env: CAKEPHP_VERSION=3.6.*
3248

3349
cache:
3450
directories:

tests/TestCase/View/Helper/FormHelperTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,17 +1305,17 @@ public function testUploadCustomFileInput() {
13051305
$result = $this->form->file('Contact.picture');
13061306
$this->assertHtml($expected, $result);
13071307

1308-
$this->form->request = $this->form->request->withData('Contact.picture', [
1308+
$this->form->getView()->setRequest($this->form->getView()->getRequest()->withData('Contact.picture', [
13091309
'name' => '', 'type' => '', 'tmp_name' => '',
13101310
'error' => 4, 'size' => 0
1311-
]);
1311+
]));
13121312
$result = $this->form->file('Contact.picture');
13131313
$this->assertHtml($expected, $result);
13141314

1315-
$this->form->request = $this->form->request->withData(
1315+
$this->form->getView()->setRequest($this->form->getView()->getRequest()->withData(
13161316
'Contact.picture',
13171317
'no data should be set in value'
1318-
);
1318+
));
13191319
$result = $this->form->file('Contact.picture');
13201320
$this->assertHtml($expected, $result);
13211321
}

tests/TestCase/View/Helper/PaginatorHelperTest.php

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Bootstrap\View\Helper\PaginatorHelper;
66
use Cake\Core\Configure;
7-
use Cake\Network\Request;
7+
use Cake\Http\ServerRequest;
88
use Cake\Routing\Router;
99
use Cake\TestSuite\TestCase;
1010
use Cake\View\View;
@@ -26,25 +26,29 @@ class PaginatorHelperTest extends TestCase {
2626
public function setUp()
2727
{
2828
parent::setUp();
29-
$view = new View();
29+
$request = new ServerRequest([
30+
'url' => '/',
31+
'params' => [
32+
'paging' => [
33+
'Article' => [
34+
'page' => 1,
35+
'current' => 9,
36+
'count' => 62,
37+
'prevPage' => false,
38+
'nextPage' => true,
39+
'pageCount' => 7,
40+
'sort' => null,
41+
'direction' => null,
42+
'limit' => null,
43+
]
44+
]
45+
]
46+
]);
47+
$view = new View($request);
3048
$view->loadHelper('Html', [
3149
'className' => 'Bootstrap.Html'
3250
]);
3351
$this->paginator = new PaginatorHelper($view);
34-
$this->paginator->request = (new Request())
35-
->withParam('paging', [
36-
'Article' => [
37-
'page' => 1,
38-
'current' => 9,
39-
'count' => 62,
40-
'prevPage' => false,
41-
'nextPage' => true,
42-
'pageCount' => 7,
43-
'sort' => null,
44-
'direction' => null,
45-
'limit' => null,
46-
]
47-
]);
4852
Configure::write('Routing.prefixes', []);
4953
Router::reload();
5054
Router::connect('/:controller/:action/*');
@@ -53,7 +57,7 @@ public function setUp()
5357

5458
public function testNumbers()
5559
{
56-
$this->paginator->request = $this->paginator->request->withParam('paging', [
60+
$this->paginator->getView()->setRequest($this->paginator->getView()->getRequest()->withParam('paging', [
5761
'Client' => [
5862
'page' => 8,
5963
'current' => 3,
@@ -62,7 +66,7 @@ public function testNumbers()
6266
'nextPage' => 2,
6367
'pageCount' => 15,
6468
]
65-
]);
69+
]));
6670
$result = $this->paginator->numbers();
6771
$expected = [
6872
['ul' => ['class' => 'pagination']],
@@ -135,7 +139,7 @@ public function testNumbers()
135139
'/ul'
136140
];
137141
$this->assertHtml($expected, $result);
138-
$this->paginator->request = $this->paginator->request->withParam('paging', [
142+
$this->paginator->getView()->setRequest($this->paginator->getView()->getRequest()->withParam('paging', [
139143
'Client' => [
140144
'page' => 1,
141145
'current' => 3,
@@ -144,7 +148,7 @@ public function testNumbers()
144148
'nextPage' => 2,
145149
'pageCount' => 15,
146150
]
147-
]);
151+
]));
148152
$result = $this->paginator->numbers();
149153
$expected = [
150154
['ul' => ['class' => 'pagination']],
@@ -160,7 +164,7 @@ public function testNumbers()
160164
'/ul'
161165
];
162166
$this->assertHtml($expected, $result);
163-
$this->paginator->request = $this->paginator->request->withParam('paging', [
167+
$this->paginator->getView()->setRequest($this->paginator->getView()->getRequest()->withParam('paging', [
164168
'Client' => [
165169
'page' => 14,
166170
'current' => 3,
@@ -169,7 +173,7 @@ public function testNumbers()
169173
'nextPage' => 2,
170174
'pageCount' => 15,
171175
]
172-
]);
176+
]));
173177
$result = $this->paginator->numbers();
174178
$expected = [
175179
['ul' => ['class' => 'pagination']],
@@ -185,7 +189,7 @@ public function testNumbers()
185189
'/ul'
186190
];
187191
$this->assertHtml($expected, $result);
188-
$this->paginator->request = $this->paginator->request->withParam('paging', [
192+
$this->paginator->getView()->setRequest($this->paginator->getView()->getRequest()->withParam('paging', [
189193
'Client' => [
190194
'page' => 2,
191195
'current' => 3,
@@ -194,7 +198,7 @@ public function testNumbers()
194198
'nextPage' => 2,
195199
'pageCount' => 9,
196200
]
197-
]);
201+
]));
198202
$result = $this->paginator->numbers(['first' => 1]);
199203
$expected = [
200204
['ul' => ['class' => 'pagination']],
@@ -225,7 +229,7 @@ public function testNumbers()
225229
'/ul'
226230
];
227231
$this->assertHtml($expected, $result);
228-
$this->paginator->request = $this->paginator->request->withParam('paging', [
232+
$this->paginator->getView()->setRequest($this->paginator->getView()->getRequest()->withParam('paging', [
229233
'Client' => [
230234
'page' => 15,
231235
'current' => 3,
@@ -234,7 +238,7 @@ public function testNumbers()
234238
'nextPage' => 2,
235239
'pageCount' => 15,
236240
]
237-
]);
241+
]));
238242
$result = $this->paginator->numbers(['first' => 1]);
239243
$expected = [
240244
['ul' => ['class' => 'pagination']],
@@ -252,7 +256,7 @@ public function testNumbers()
252256
'/ul'
253257
];
254258
$this->assertHtml($expected, $result);
255-
$this->paginator->request = $this->paginator->request->withParam('paging', [
259+
$this->paginator->getView()->setRequest($this->paginator->getView()->getRequest()->withParam('paging', [
256260
'Client' => [
257261
'page' => 10,
258262
'current' => 3,
@@ -261,7 +265,7 @@ public function testNumbers()
261265
'nextPage' => 2,
262266
'pageCount' => 15,
263267
]
264-
]);
268+
]));
265269
$result = $this->paginator->numbers(['first' => 1, 'last' => 1]);
266270
$expected = [
267271
['ul' => ['class' => 'pagination']],
@@ -280,7 +284,7 @@ public function testNumbers()
280284
'/ul'
281285
];
282286
$this->assertHtml($expected, $result);
283-
$this->paginator->request = $this->paginator->request->withParam('paging', [
287+
$this->paginator->getView()->setRequest($this->paginator->getView()->getRequest()->withParam('paging', [
284288
'Client' => [
285289
'page' => 6,
286290
'current' => 15,
@@ -289,7 +293,7 @@ public function testNumbers()
289293
'nextPage' => 1,
290294
'pageCount' => 42,
291295
]
292-
]);
296+
]));
293297
$result = $this->paginator->numbers(['first' => 1, 'last' => 1]);
294298
$expected = [
295299
['ul' => ['class' => 'pagination']],
@@ -308,7 +312,7 @@ public function testNumbers()
308312
'/ul'
309313
];
310314
$this->assertHtml($expected, $result);
311-
$this->paginator->request = $this->paginator->request->withParam('paging', [
315+
$this->paginator->getView()->setRequest($this->paginator->getView()->getRequest()->withParam('paging', [
312316
'Client' => [
313317
'page' => 37,
314318
'current' => 15,
@@ -317,7 +321,7 @@ public function testNumbers()
317321
'nextPage' => 1,
318322
'pageCount' => 42,
319323
]
320-
]);
324+
]));
321325
$result = $this->paginator->numbers(['first' => 1, 'last' => 1]);
322326
$expected = [
323327
['ul' => ['class' => 'pagination']],

0 commit comments

Comments
 (0)