From 3123248b5921f557016abc442fe78155b0e3808c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 24 Dec 2014 16:11:15 +0100 Subject: [PATCH] [FrameworkBundle] added a test router for the buil-in web server --- .../Command/ServerRunCommand.php | 4 +-- .../Resources/config/router_test.php | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Resources/config/router_test.php diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 462ff09ca5b8c..38f0c07e6fca6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -68,8 +68,8 @@ protected function configure() %command.full_name% --router=app/config/router.php -Specifing a router script is required when the used environment is not "dev" or -"prod". +Specifing a router script is required when the used environment is not "dev", +"prod", or "test". See also: http://www.php.net/manual/en/features.commandline.webserver.php EOF diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_test.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_test.php new file mode 100644 index 0000000000000..5b020d5d22977 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_test.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * This file implements rewrite rules for PHP built-in web server. + * + * See: http://www.php.net/manual/en/features.commandline.webserver.php + * + * If you have custom directory layout, then you have to write your own router + * and pass it as a value to 'router' option of server:run command. + * + * @author: MichaƂ Pipa + * @author: Albert Jessurum + */ + +if (is_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME'])) { + return false; +} + +$_SERVER = array_merge($_SERVER, $_ENV); +$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app_test.php'; + +require 'app_test.php'; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy