Merge pull request #13446 from garethellis36/ControllerTestCase/create-dispatcher

2.x - Moves creation of ControllerTestDispatcher to its own protected method
This commit is contained in:
Mark Story 2019-07-29 21:58:27 -04:00 committed by GitHub
commit 31dbda0a71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -265,7 +265,7 @@ abstract class ControllerTestCase extends CakeTestCase {
->will($this->returnValue($options['data'])); ->will($this->returnValue($options['data']));
} }
$Dispatch = new ControllerTestDispatcher(); $Dispatch = $this->_createDispatcher();
foreach (Router::$routes as $route) { foreach (Router::$routes as $route) {
if ($route instanceof RedirectRoute) { if ($route instanceof RedirectRoute) {
$route->response = $this->getMock('CakeResponse', array('send')); $route->response = $this->getMock('CakeResponse', array('send'));
@ -315,6 +315,15 @@ abstract class ControllerTestCase extends CakeTestCase {
return $this->{$options['return']}; return $this->{$options['return']};
} }
/**
* Creates the test dispatcher class
*
* @return Dispatcher
*/
protected function _createDispatcher() {
return new ControllerTestDispatcher();
}
/** /**
* Generates a mocked controller and mocks any classes passed to `$mocks`. By * Generates a mocked controller and mocks any classes passed to `$mocks`. By
* default, `_stop()` is stubbed as is sending the response headers, so to not * default, `_stop()` is stubbed as is sending the response headers, so to not