Consider KERNEL_DIR setting as relative to the PhpUnit XML file if it does not point to a directory (relative to the current cwd)

This commit is contained in:
Matthias Pigulla 2013-11-24 23:56:46 +01:00
parent 4aab341d59
commit 05dc0e17b2

View File

@ -124,7 +124,15 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase
*/
protected static function getKernelClass()
{
$dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : static::getPhpUnitXmlDir();
$dir = $phpUnitDir = static::getPhpUnitXmlDir();
if (isset($_SERVER['KERNEL_DIR'])) {
$dir = $_SERVER['KERNEL_DIR'];
if (!is_dir($dir) && is_dir("$phpUnitDir/$dir")) {
$dir = "$phpUnitDir/$dir";
}
}
$finder = new Finder();
$finder->name('*Kernel.php')->depth(0)->in($dir);