79 lines
2.2 KiB
PHP
Raw Normal View History

2012-04-13 14:11:54 +02:00
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nelmio\ApiDocBundle\Tests\Functional;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
/**
* App Test Kernel for functional tests.
*/
class AppKernel extends Kernel
{
public function registerBundles(): iterable
2012-04-13 14:11:54 +02:00
{
2024-10-01 15:54:04 +03:00
$bundles = [
2012-04-13 14:11:54 +02:00
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new \Symfony\Bundle\TwigBundle\TwigBundle(),
new \JMS\SerializerBundle\JMSSerializerBundle($this),
2012-04-13 14:11:54 +02:00
new \Nelmio\ApiDocBundle\NelmioApiDocBundle(),
new \Nelmio\ApiDocBundle\Tests\Fixtures\NelmioApiDocTestBundle(),
2024-10-01 15:54:04 +03:00
];
2012-04-13 14:11:54 +02:00
2015-04-28 23:29:18 +02:00
if (class_exists('Dunglas\ApiBundle\DunglasApiBundle')) {
2015-03-15 23:48:57 +01:00
$bundles[] = new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle();
2015-04-28 23:29:18 +02:00
$bundles[] = new \Dunglas\ApiBundle\DunglasApiBundle();
2015-03-15 23:48:57 +01:00
}
return $bundles;
2012-04-13 14:11:54 +02:00
}
public function getProjectDir(): string
2012-04-13 14:11:54 +02:00
{
return __DIR__;
}
public function getCacheDir(): string
2012-04-13 14:11:54 +02:00
{
2024-10-01 15:54:04 +03:00
return sys_get_temp_dir() . '/' . Kernel::VERSION . '/nelmio-api-doc/cache/' . $this->environment;
2012-04-13 14:11:54 +02:00
}
public function getLogDir(): string
2012-04-13 14:11:54 +02:00
{
2024-10-01 15:54:04 +03:00
return sys_get_temp_dir() . '/' . Kernel::VERSION . '/nelmio-api-doc/logs';
2012-04-13 14:11:54 +02:00
}
2024-10-01 15:54:04 +03:00
public function registerContainerConfiguration(LoaderInterface $loader): void
2012-04-13 14:11:54 +02:00
{
2024-10-01 15:54:04 +03:00
$loader->load(__DIR__ . '/config/' . $this->environment . '.yml');
2015-03-15 23:48:57 +01:00
2015-04-28 23:29:18 +02:00
if (class_exists('Dunglas\ApiBundle\DunglasApiBundle')) {
2024-10-01 15:54:04 +03:00
$loader->load(__DIR__ . '/config/dunglas_api.yml');
2015-03-15 23:48:57 +01:00
}
2015-11-30 19:19:17 +01:00
// If symfony/framework-bundle > 3.0
if (!class_exists('Symfony\Bundle\FrameworkBundle\Command\RouterApacheDumperCommand')) {
2024-10-01 15:54:04 +03:00
$loader->load(__DIR__ . '/config/twig_assets.yml');
2015-11-30 19:19:17 +01:00
}
2012-04-13 14:11:54 +02:00
}
public function serialize()
{
2024-10-01 15:54:04 +03:00
return serialize([$this->getEnvironment(), $this->isDebug()]);
2012-04-13 14:11:54 +02:00
}
2024-10-01 15:54:04 +03:00
public function unserialize($str): void
2012-04-13 14:11:54 +02:00
{
2024-10-01 15:54:04 +03:00
call_user_func_array([$this, '__construct'], unserialize($str));
2012-04-13 14:11:54 +02:00
}
}