WebTestCase.php (866B)
1 <?php 2 /** 3 * Created by PhpStorm. 4 * User: felicitus 5 * Date: 10/9/15 6 * Time: 7:43 PM. 7 */ 8 9 namespace PartKeepr\CoreBundle\Tests; 10 11 /** 12 * Special WebTestCase which forces to load the AppKernel. This is because the base getKernelClass() method 13 * does wildcard matching on *Kernel.php within the app/ directory, and on some systems it might happen that 14 * SetupAppKernel gets loaded first, causing unit tests to fail. 15 */ 16 class WebTestCase extends \Liip\FunctionalTestBundle\Test\WebTestCase 17 { 18 protected static function getKernelClass() 19 { 20 $dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : self::getPhpUnitXmlDir(); 21 22 $class = 'AppKernel'; 23 $file = $dir.'/'.$class.'.php'; 24 if (!file_exists($file)) { 25 return parent::getKernelClass(); 26 } 27 require_once $file; 28 29 return $class; 30 } 31 }