mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #10517 from ndm2/2.x-fix-controller-test-case-base-incompatibility
2.x - Fix `ControllerTestCase::testAction()` incompatibility with `App.base`.
This commit is contained in:
commit
cefbcf33f0
2 changed files with 28 additions and 1 deletions
|
@ -624,4 +624,30 @@ class ControllerTestCaseTest extends CakeTestCase {
|
|||
$this->assertEquals($restored, $_POST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the `App.base` path is properly stripped from the URL generated from the
|
||||
* given URL array, and that consequently the correct controller/action is being matched.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAppBaseConfigCompatibilityWithArrayUrls() {
|
||||
Configure::write('App.base', '/cakephp');
|
||||
|
||||
$this->Case->generate('TestsApps');
|
||||
$this->Case->testAction(array('controller' => 'tests_apps', 'action' => 'index'));
|
||||
|
||||
$this->assertEquals('/cakephp', $this->Case->controller->request->base);
|
||||
$this->assertEquals('/cakephp/', $this->Case->controller->request->webroot);
|
||||
$this->assertEquals('/cakephp/tests_apps', $this->Case->controller->request->here);
|
||||
$this->assertEquals('tests_apps', $this->Case->controller->request->url);
|
||||
|
||||
$expected = array(
|
||||
'plugin' => null,
|
||||
'controller' => 'tests_apps',
|
||||
'action' => 'index',
|
||||
'named' => array(),
|
||||
'pass' => array(),
|
||||
);
|
||||
$this->assertEquals($expected, array_intersect_key($expected, $this->Case->controller->request->params));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,7 +248,8 @@ abstract class ControllerTestCase extends CakeTestCase {
|
|||
$_GET = array();
|
||||
}
|
||||
}
|
||||
$request = $this->getMock('CakeRequest', array('_readInput'), array($url));
|
||||
$_SERVER['REQUEST_URI'] = $url;
|
||||
$request = $this->getMock('CakeRequest', array('_readInput'));
|
||||
|
||||
if (is_string($options['data'])) {
|
||||
$request->expects($this->any())
|
||||
|
|
Loading…
Reference in a new issue