本文整理汇总了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;
}
示例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;
}
示例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');
}
}
示例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();
}