Skip to content

Commit 99f47e1

Browse files
author
euromark
committed
Allow an array for URLs to be consistent with assertRedirect().
1 parent 43f053f commit 99f47e1

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

src/TestSuite/IntegrationTestCase.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function cookie($name, $value) {
174174
* a property. You can use various assert methods to check the
175175
* response.
176176
*
177-
* @param string $url The url to request.
177+
* @param string|array $url The URL to request.
178178
* @return void
179179
*/
180180
public function get($url) {
@@ -188,7 +188,7 @@ public function get($url) {
188188
* a property. You can use various assert methods to check the
189189
* response.
190190
*
191-
* @param string $url The url to request.
191+
* @param string|array $url The URL to request.
192192
* @param array $data The data for the request.
193193
* @return void
194194
*/
@@ -203,7 +203,7 @@ public function post($url, $data = []) {
203203
* a property. You can use various assert methods to check the
204204
* response.
205205
*
206-
* @param string $url The url to request.
206+
* @param string|array $url The URL to request.
207207
* @param array $data The data for the request.
208208
* @return void
209209
*/
@@ -218,7 +218,7 @@ public function patch($url, $data = []) {
218218
* a property. You can use various assert methods to check the
219219
* response.
220220
*
221-
* @param string $url The url to request.
221+
* @param string|array $url The URL to request.
222222
* @param array $data The data for the request.
223223
* @return void
224224
*/
@@ -233,7 +233,7 @@ public function put($url, $data = []) {
233233
* a property. You can use various assert methods to check the
234234
* response.
235235
*
236-
* @param string $url The url to request.
236+
* @param string|array $url The URL to request.
237237
* @return void
238238
*/
239239
public function delete($url) {
@@ -245,7 +245,7 @@ public function delete($url) {
245245
*
246246
* Receives and stores the response for future inspection.
247247
*
248-
* @param string $url The url
248+
* @param string|array $url The URL
249249
* @param string $method The HTTP method
250250
* @param array|null $data The request data.
251251
* @return void
@@ -313,7 +313,7 @@ protected function _handleError($exception) {
313313
/**
314314
* Create a request object with the configured options and parameters.
315315
*
316-
* @param string $url The url
316+
* @param string|array $url The URL
317317
* @param string $method The HTTP method
318318
* @param array|null $data The request data.
319319
* @return \Cake\Network\Request The built request.
@@ -326,7 +326,7 @@ protected function _buildRequest($url, $method, $data) {
326326
$session->write($this->_session);
327327

328328
$props = [
329-
'url' => $url,
329+
'url' => Router::url($url),
330330
'post' => $data,
331331
'cookies' => $this->_cookie,
332332
'session' => $session,

tests/TestCase/TestSuite/IntegrationTestCaseTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ public function testRequestSetsProperties() {
9292
$this->assertEquals('value', $this->viewVariable('test'));
9393
}
9494

95+
/**
96+
* Test array URLs
97+
*
98+
* @return void
99+
*/
100+
public function testArrayUrls() {
101+
$this->post(['controller' => 'Posts', 'action' => 'index']);
102+
$this->assertEquals('value', $this->viewVariable('test'));
103+
}
104+
95105
/**
96106
* Test flash and cookie assertions
97107
*
@@ -196,10 +206,10 @@ public function testAssertResponseContains() {
196206
}
197207

198208
/**
199-
* Test that works in tandem with testEventManagerReset2 to
209+
* Test that works in tandem with testEventManagerReset2 to
200210
* test the EventManager reset.
201211
*
202-
* The return value is passed to testEventManagerReset2 as
212+
* The return value is passed to testEventManagerReset2 as
203213
* an arguments.
204214
*
205215
* @return \Cake\Event\EventManager

0 commit comments

Comments
 (0)