diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php index b8ec208c1dbe4..26781cdf2285c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php @@ -106,6 +106,14 @@ private static function getPhpUnitCliConfigArgument() */ protected static function getKernelClass() { + if (isset($_SERVER['KERNEL_CLASS'])) { + if (!class_exists($class = $_SERVER['KERNEL_CLASS'])) { + 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)); + } + + return $class; + } + if (isset($_SERVER['KERNEL_DIR'])) { $dir = $_SERVER['KERNEL_DIR'];