Skip to content

Commit a08463e

Browse files
committed
fixed $_ENV/$_SERVER precedence in test framework
1 parent 6df0bf1 commit a08463e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Test/KernelTestCase.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private static function getPhpUnitCliConfigArgument()
107107
protected static function getKernelClass()
108108
{
109109
if (isset($_SERVER['KERNEL_CLASS']) || isset($_ENV['KERNEL_CLASS'])) {
110-
$class = isset($_SERVER['KERNEL_CLASS']) ? $_SERVER['KERNEL_CLASS'] : $_ENV['KERNEL_CLASS'];
110+
$class = isset($_ENV['KERNEL_CLASS']) ? $_ENV['KERNEL_CLASS'] : $_SERVER['KERNEL_CLASS'];
111111
if (!class_exists($class)) {
112112
throw new \RuntimeException(sprintf('Class "%s" doesn\'t exist or cannot be autoloaded. Check that the KERNEL_CLASS value in phpunit.xml matches the fully-qualified class name of your Kernel or override the %s::createKernel() method.', $class, static::class));
113113
}
@@ -116,7 +116,7 @@ protected static function getKernelClass()
116116
}
117117

118118
if (isset($_SERVER['KERNEL_DIR']) || isset($_ENV['KERNEL_DIR'])) {
119-
$dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : $_ENV['KERNEL_DIR'];
119+
$dir = isset($_ENV['KERNEL_DIR']) ? $_ENV['KERNEL_DIR'] : $_SERVER['KERNEL_DIR'];
120120

121121
if (!is_dir($dir)) {
122122
$phpUnitDir = static::getPhpUnitXmlDir();
@@ -176,20 +176,20 @@ protected static function createKernel(array $options = array())
176176

177177
if (isset($options['environment'])) {
178178
$env = $options['environment'];
179-
} elseif (isset($_SERVER['APP_ENV'])) {
180-
$env = $_SERVER['APP_ENV'];
181179
} elseif (isset($_ENV['APP_ENV'])) {
182180
$env = $_ENV['APP_ENV'];
181+
} elseif (isset($_SERVER['APP_ENV'])) {
182+
$env = $_SERVER['APP_ENV'];
183183
} else {
184184
$env = 'test';
185185
}
186186

187187
if (isset($options['debug'])) {
188188
$debug = $options['debug'];
189-
} elseif (isset($_SERVER['APP_DEBUG'])) {
190-
$debug = $_SERVER['APP_DEBUG'];
191189
} elseif (isset($_ENV['APP_DEBUG'])) {
192190
$debug = $_ENV['APP_DEBUG'];
191+
} elseif (isset($_SERVER['APP_DEBUG'])) {
192+
$debug = $_SERVER['APP_DEBUG'];
193193
} else {
194194
$debug = true;
195195
}

0 commit comments

Comments
 (0)