Skip to content

Commit 89b26c0

Browse files
committed
[FrameworkBundle] added a test router for the buil-in web server
1 parent 87e0e22 commit 89b26c0

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ protected function configure()
6868
6969
<info>%command.full_name% --router=app/config/router.php</info>
7070
71-
Specifing a router script is required when the used environment is not "dev" or
72-
"prod".
71+
Specifing a router script is required when the used environment is not "dev",
72+
"prod", or "test".
7373
7474
See also: http://www.php.net/manual/en/features.commandline.webserver.php
7575
EOF
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
/*
13+
* This file implements rewrite rules for PHP built-in web server.
14+
*
15+
* See: http://www.php.net/manual/en/features.commandline.webserver.php
16+
*
17+
* If you have custom directory layout, then you have to write your own router
18+
* and pass it as a value to 'router' option of server:run command.
19+
*
20+
* @author: Michał Pipa <michal.pipa.xsolve@gmail.com>
21+
* @author: Albert Jessurum <ajessu@gmail.com>
22+
*/
23+
24+
if (is_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME'])) {
25+
return false;
26+
}
27+
28+
$_SERVER = array_merge($_SERVER, $_ENV);
29+
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app_test.php';
30+
31+
require 'app_test.php';

0 commit comments

Comments
 (0)
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