2016-07-12 00:33:55 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2016-12-29 12:09:26 +01:00
|
|
|
* This file is part of the NelmioApiDocBundle package.
|
2016-07-12 00:33:55 +02:00
|
|
|
*
|
2016-12-29 12:09:26 +01:00
|
|
|
* (c) Nelmio
|
2016-07-12 00:33:55 +02:00
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2016-07-29 10:22:40 +02:00
|
|
|
use ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle;
|
2016-12-29 12:09:26 +01:00
|
|
|
use Nelmio\ApiDocBundle\NelmioApiDocBundle;
|
|
|
|
use Nelmio\ApiDocBundle\Tests\Functional\TestBundle;
|
2016-07-12 00:33:55 +02:00
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
2016-11-18 22:16:53 +01:00
|
|
|
use Symfony\Bundle\TwigBundle\TwigBundle;
|
2016-07-12 00:33:55 +02:00
|
|
|
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(),
|
2016-11-18 22:16:53 +01:00
|
|
|
new TwigBundle(),
|
2016-07-12 00:33:55 +02:00
|
|
|
new SensioFrameworkExtraBundle(),
|
2016-07-29 10:22:40 +02:00
|
|
|
new ApiPlatformBundle(),
|
2016-12-29 12:09:26 +01:00
|
|
|
new NelmioApiDocBundle(),
|
2016-07-29 10:22:40 +02:00
|
|
|
new TestBundle(),
|
2016-07-12 00:33:55 +02:00
|
|
|
];
|
|
|
|
}
|
2016-07-15 00:04:07 +02:00
|
|
|
|
2016-07-12 00:33:55 +02:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
protected function configureRoutes(RouteCollectionBuilder $routes)
|
|
|
|
{
|
|
|
|
$routes->import(__DIR__.'/Controller/', '/', 'annotation');
|
2016-07-29 10:22:40 +02:00
|
|
|
$routes->import('', '/api', 'api_platform');
|
2017-01-18 18:02:00 +01:00
|
|
|
$routes->import('@NelmioApiDocBundle/Resources/config/routing/swaggerui.xml', '/docs');
|
2016-07-12 00:33:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
|
|
|
|
{
|
|
|
|
$c->loadFromExtension('framework', [
|
|
|
|
'secret' => 'MySecretKey',
|
2016-07-29 10:22:40 +02:00
|
|
|
'test' => null,
|
|
|
|
'validation' => null,
|
2017-01-18 18:02:00 +01:00
|
|
|
'templating' => [
|
|
|
|
'engines' => ['twig'],
|
|
|
|
],
|
2016-07-12 00:33:55 +02:00
|
|
|
]);
|
2016-11-30 14:08:10 +01:00
|
|
|
|
|
|
|
// Filter routes
|
2016-12-29 12:09:26 +01:00
|
|
|
$c->loadFromExtension('nelmio_api_doc', [
|
2017-01-25 18:53:19 +01:00
|
|
|
'documentation' => [
|
|
|
|
'info' => [
|
|
|
|
'title' => 'My Test App',
|
|
|
|
],
|
|
|
|
],
|
2017-02-07 19:14:35 +01:00
|
|
|
'routes' => [
|
2016-11-30 14:08:10 +01:00
|
|
|
'path_patterns' => ['^/api(?!/admin)'],
|
|
|
|
],
|
|
|
|
]);
|
2016-07-12 00:33:55 +02:00
|
|
|
}
|
|
|
|
}
|