当前位置: 首页>>代码示例>>PHP>>正文


PHP WebTestCase::getKernelClass方法代码示例

本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Test\WebTestCase::getKernelClass方法的典型用法代码示例。如果您正苦于以下问题:PHP WebTestCase::getKernelClass方法的具体用法?PHP WebTestCase::getKernelClass怎么用?PHP WebTestCase::getKernelClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Bundle\FrameworkBundle\Test\WebTestCase的用法示例。


在下文中一共展示了WebTestCase::getKernelClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getKernelClass

 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;
 }
开发者ID:TIFU124,项目名称:LiipFunctionalTestBundle,代码行数:12,代码来源:WebTestCase.php

示例2: getKernelClass

 /**
  * {@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;
 }
开发者ID:nmallare,项目名称:platform,代码行数:18,代码来源:WebTestCase.php

示例3: getKernelClass

 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');
     }
 }
开发者ID:steffenbrem,项目名称:ApiTestCase,代码行数:14,代码来源:ApiTestCase.php

示例4: getKernelClass

 /**
  * 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();
 }
开发者ID:webfactory,项目名称:symfony-application-tests,代码行数:22,代码来源:AbstractContainerTestCase.php


注:本文中的Symfony\Bundle\FrameworkBundle\Test\WebTestCase::getKernelClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。