File tree Expand file tree Collapse file tree 5 files changed +11
-36
lines changed
tests/System/ApplicationBundle Expand file tree Collapse file tree 5 files changed +11
-36
lines changed Original file line number Diff line number Diff line change 106106 },
107107 "extra" : {
108108 "branch-alias" : {
109- "dev-master " : " 5.0.x-dev"
109+ "dev-ISSUE-337 " : " 5.0.x-dev"
110110 },
111111 "symfony-app-dir" : " " ,
112112 "symfony-bin-dir" : " bin" ,
Original file line number Diff line number Diff line change 88require dirname (__DIR__ ) . '/vendor/autoload.php ' ;
99
1010Bootstrap::getInstance ()
11+ ->unsetHeaders ()
1112 ->ensureDevelopmentOrTestingEnvironment ()
1213 ->setEnvironment (Environment::TESTING )
1314 ->configure ()
Original file line number Diff line number Diff line change 2929 */
3030class Bootstrap
3131{
32- /**
33- * @var Bootstrap|null
34- */
3532 private static ?Bootstrap $ instance = null ;
36-
37- /**
38- * @var bool
39- */
4033 private bool $ isConfigured = false ;
41-
42- /**
43- * @var string
44- */
4534 private string $ environment = Environment::DEFAULT_ENVIRONMENT ;
46-
47- /**
48- * @var ApplicationKernel
49- */
50- private $ applicationKernel = null ;
51-
52- /**
53- * @var ApplicationStructure
54- */
35+ private ?ApplicationKernel $ applicationKernel = null ;
5536 private ApplicationStructure $ applicationStructure ;
56-
5737 private ErrorHandler $ errorHandler ;
5838
5939 /**
@@ -115,25 +95,16 @@ public function setEnvironment(string $environment): Bootstrap
11595 return $ this ;
11696 }
11797
118- /**
119- * @return string
120- */
12198 public function getEnvironment (): string
12299 {
123100 return $ this ->environment ;
124101 }
125102
126- /**
127- * @return bool
128- */
129103 private function isSymfonyDebugModeEnabled (): bool
130104 {
131105 return $ this ->environment !== Environment::PRODUCTION ;
132106 }
133107
134- /**
135- * @return bool
136- */
137108 private function isDebugEnabled (): bool
138109 {
139110 return $ this ->environment !== Environment::PRODUCTION ;
@@ -166,6 +137,12 @@ public function ensureDevelopmentOrTestingEnvironment(): self
166137 return $ this ;
167138 }
168139
140+ public function unsetHeaders (): self
141+ {
142+ unset($ _SERVER ['HTTP_X_FORWARDED_FOR ' ]);
143+ return $ this ;
144+ }
145+
169146 /**
170147 * Main entry point called at every request usually from global scope. Checks if everything is correct
171148 * and loads the configuration.
Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ protected function startSymfonyServer(): void
4242
4343 $ this ->serverProcess = new Process (
4444 $ this ->getSymfonyServerStartCommand (),
45- $ this ->getApplicationRoot ()
45+ $ this ->getApplicationRoot (),
46+ ['APP_ENV ' => 'test ' ]
4647 );
4748 $ this ->serverProcess ->start ();
4849
Original file line number Diff line number Diff line change @@ -22,10 +22,6 @@ class PhpListApplicationBundleTest extends TestCase
2222 protected function setUp (): void
2323 {
2424 parent ::setUp ();
25-
26- putenv ('APP_ENV=test ' );
27- $ _ENV ['APP_ENV ' ] = 'test ' ;
28- $ _SERVER ['APP_ENV ' ] = 'test ' ;
2925 $ this ->httpClient = new Client (['http_errors ' => false ]);
3026 }
3127
You can’t perform that action at this time.
0 commit comments