protected static function getKernelClass()
 {
     $dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : self::getPhpUnitXmlDir();
     list($appname) = explode('\\', get_called_class());
     $class = $appname . 'Kernel';
     $file = $dir . '/' . strtolower($appname) . '/' . $class . '.php';
     if (!file_exists($file)) {
         return parent::getKernelClass();
     }
     require_once $file;
     return $class;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected static function getKernelClass()
 {
     $dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : static::getPhpUnitXmlDir();
     $finder = new Finder();
     $finder->name('AppKernel.php')->depth(0)->in($dir);
     $results = iterator_to_array($finder);
     if (count($results)) {
         $file = current($results);
         $class = $file->getBasename('.php');
         require_once $file;
     } else {
         $class = parent::getKernelClass();
     }
     return $class;
 }
Ejemplo n.º 3
0
 protected static function getKernelClass()
 {
     if (!isset($_SERVER['KERNEL_CLASS_PATH'])) {
         return parent::getKernelClass();
     }
     if (file_exists($_SERVER['KERNEL_CLASS_PATH'])) {
         require_once $_SERVER['KERNEL_CLASS_PATH'];
         return (new \SplFileInfo($_SERVER['KERNEL_CLASS_PATH']))->getBasename('.php');
     }
     if (file_exists(static::getPhpUnitXmlDir() . \DIRECTORY_SEPARATOR . $_SERVER['KERNEL_CLASS_PATH'])) {
         require_once static::getPhpUnitXmlDir() . \DIRECTORY_SEPARATOR . $_SERVER['KERNEL_CLASS_PATH'];
         return (new \SplFileInfo(static::getPhpUnitXmlDir() . \DIRECTORY_SEPARATOR . $_SERVER['KERNEL_CLASS_PATH']))->getBasename('.php');
     }
 }
 /**
  * Returns the class name of the kernel that is used in the tests.
  *
  * Besides Symfony's default kernel detection, this method allows providing a
  * kernel class via KERNEL_CLASS environment variable.
  * The provided class must be loadable by the class loader.
  *
  * @return string
  * @throws \InvalidArgumentException If a kernel class was provided, but it is not available via class loader.
  * @see http://symfony.com/doc/current/book/testing.html#your-first-functional-test
  */
 protected static function getKernelClass()
 {
     if (isset($_SERVER['KERNEL_CLASS'])) {
         if (!class_exists($_SERVER['KERNEL_CLASS'], true)) {
             $message = 'The kernel class that is provided via KERNEL_CLASS environment variable must ' . 'be available by class loader.';
             throw new \InvalidArgumentException($message);
         }
         return $_SERVER['KERNEL_CLASS'];
     }
     return parent::getKernelClass();
 }