You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* When the Kernel is located, the file is required.
110
-
*
111
33
* @return string The Kernel class name
112
34
*
113
35
* @throws \RuntimeException
36
+
* @throws \LogicException
114
37
*/
115
38
protectedstaticfunctiongetKernelClass()
116
39
{
117
-
if (isset($_SERVER['KERNEL_CLASS'])) {
118
-
if (!class_exists($class = $_SERVER['KERNEL_CLASS'])) {
119
-
thrownew \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));
120
-
}
121
-
122
-
return$class;
123
-
} else {
124
-
@trigger_error(sprintf('Using the KERNEL_DIR environment variable or the automatic guessing based on the phpunit.xml / phpunit.xml.dist file location is deprecated since 3.4. Set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel instead. Not setting the KERNEL_CLASS environment variable will throw an exception on 4.0 unless you override the %1$::createKernel() or %1$::getKernelClass() method.', static::class), E_USER_DEPRECATED);
125
-
}
126
-
127
-
if (isset($_SERVER['KERNEL_DIR'])) {
128
-
$dir = $_SERVER['KERNEL_DIR'];
129
-
130
-
if (!is_dir($dir)) {
131
-
$phpUnitDir = static::getPhpUnitXmlDir();
132
-
if (is_dir("$phpUnitDir/$dir")) {
133
-
$dir = "$phpUnitDir/$dir";
134
-
}
135
-
}
136
-
} else {
137
-
$dir = static::getPhpUnitXmlDir();
40
+
if (!isset($_SERVER['KERNEL_CLASS'])) {
41
+
thrownew \LogicException(sprintf('You must set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel in phpunit.xml / phpunit.xml.dist or override the %1$::createKernel() or %1$::getKernelClass() method.', static::class));
138
42
}
139
43
140
-
$finder = newFinder();
141
-
$finder->name('*Kernel.php')->depth(0)->in($dir);
142
-
$results = iterator_to_array($finder);
143
-
if (!count($results)) {
144
-
thrownew \RuntimeException('Either set KERNEL_DIR in your phpunit.xml according to https://symfony.com/doc/current/book/testing.html#your-first-functional-test or override the WebTestCase::createKernel() method.');
44
+
if (!class_exists($class = $_SERVER['KERNEL_CLASS'])) {
45
+
thrownew \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));
0 commit comments