diff --git a/README.md b/README.md index ac69355..fd2da96 100644 --- a/README.md +++ b/README.md @@ -62,3 +62,7 @@ extensions: startDelay: 1 phpIni: /etc/php5/apache2/php.ini ``` +### additional configuration options: +Option Name | Value | Description +--- | --- | --- +alwaysUseRouter | boolean (default: false) | If enabled, all requests will use the specified router file regardless of if the file requested exists in the documentRoot \ No newline at end of file diff --git a/src/Codeception/Extension/PhpBuiltinServer.php b/src/Codeception/Extension/PhpBuiltinServer.php index ae87cbc..3b30741 100644 --- a/src/Codeception/Extension/PhpBuiltinServer.php +++ b/src/Codeception/Extension/PhpBuiltinServer.php @@ -69,6 +69,9 @@ private function getCommand() if (isset($this->config['router'])) { $parameters .= ' -dcodecept.user_router="' . $this->config['router'] . '"'; } + if (isset($this->config['alwaysUseRouter'])) { + $parameters .= ' -dcodecept.always_use_router="' . $this->config['alwaysUseRouter'] . '"'; + } if (isset($this->config['directoryIndex'])) { $parameters .= ' -dcodecept.directory_index="' . $this->config['directoryIndex'] . '"'; } diff --git a/src/Codeception/Extension/Router.php b/src/Codeception/Extension/Router.php index 2d39ef0..44a6fe1 100644 --- a/src/Codeception/Extension/Router.php +++ b/src/Codeception/Extension/Router.php @@ -31,7 +31,7 @@ static public function main() file_put_contents($accessLog, $logEntry, FILE_APPEND); } - if (file_exists($filePath) && is_file($filePath)) { + if (file_exists($filePath) && is_file($filePath) && !get_cfg_var('codecept.always_use_router')) { return false; // serve the requested resource as-is. } elseif ($userRouter) { return include $userRouter;