From 4f6891255232755bf42f5530a80dffeb565944f7 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Mon, 8 May 2017 09:56:03 +0200 Subject: [PATCH] [FrameworkBundle] KernelTestCase: allow to provide the kernel class with a var --- .../Bundle/FrameworkBundle/Test/KernelTestCase.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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'];