2017-01-19 09:43:44 +01:00

72 lines
1.9 KiB
PHP

<?php
/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle;
use Nelmio\ApiDocBundle\NelmioApiDocBundle;
use Nelmio\ApiDocBundle\Tests\Functional\TestBundle;
use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
class TestKernel extends Kernel
{
use MicroKernelTrait;
/**
* {@inheritdoc}
*/
public function registerBundles()
{
return [
new FrameworkBundle(),
new TwigBundle(),
new SensioFrameworkExtraBundle(),
new ApiPlatformBundle(),
new NelmioApiDocBundle(),
new TestBundle(),
];
}
/**
* {@inheritdoc}
*/
protected function configureRoutes(RouteCollectionBuilder $routes)
{
$routes->import(__DIR__.'/Controller/', '/', 'annotation');
$routes->import('', '/api', 'api_platform');
}
/**
* {@inheritdoc}
*/
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
{
$c->loadFromExtension('framework', [
'secret' => 'MySecretKey',
'test' => null,
'validation' => null,
]);
// Filter routes
$c->loadFromExtension('nelmio_api_doc', [
'source_folder' => '%kernel.root_dir%',
'routes' => [
'path_patterns' => ['^/api(?!/admin)'],
],
]);
}
}