|
|
@@ -55,6 +55,13 @@ class MiddlewareDispatcher
|
|
|
protected $_constructorArgs;
|
|
|
|
|
|
/**
|
|
|
+ * Allow router reloading to be disabled.
|
|
|
+ *
|
|
|
+ * @var bool
|
|
|
+ */
|
|
|
+ protected $_disableRouterReload = false;
|
|
|
+
|
|
|
+ /**
|
|
|
* The application that is being dispatched.
|
|
|
*
|
|
|
* @var \Cake\Core\HttpApplicationInterface
|
|
|
@@ -68,13 +75,15 @@ class MiddlewareDispatcher
|
|
|
* @param string|null $class The application class name. Defaults to App\Application.
|
|
|
* @param array|null $constructorArgs The constructor arguments for your application class.
|
|
|
* Defaults to `['./config']`
|
|
|
+ * @param bool $disableRouterReload Disable Router::reload() call.
|
|
|
* @throws \LogicException If it cannot load class for use in integration testing.
|
|
|
*/
|
|
|
- public function __construct($test, $class = null, $constructorArgs = null)
|
|
|
+ public function __construct($test, $class = null, $constructorArgs = null, $disableRouterReload = false)
|
|
|
{
|
|
|
$this->_test = $test;
|
|
|
$this->_class = $class ?: Configure::read('App.namespace') . '\Application';
|
|
|
$this->_constructorArgs = $constructorArgs ?: [CONFIG];
|
|
|
+ $this->_disableRouterReload = $disableRouterReload;
|
|
|
|
|
|
try {
|
|
|
$reflect = new ReflectionClass($this->_class);
|
|
|
@@ -126,7 +135,9 @@ class MiddlewareDispatcher
|
|
|
}
|
|
|
|
|
|
$out = Router::url($url);
|
|
|
- Router::reload();
|
|
|
+ if (!$this->_disableRouterReload) {
|
|
|
+ Router::reload();
|
|
|
+ }
|
|
|
|
|
|
return $out;
|
|
|
}
|