2017-11-29 19:29:54 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Knp\Bundle\MarkdownBundle\Tests;
|
|
|
|
|
|
|
|
use Knp\Bundle\MarkdownBundle\KnpMarkdownBundle;
|
|
|
|
use Knp\Bundle\MarkdownBundle\Parser\MarkdownParser;
|
2021-11-08 12:24:51 +01:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2017-11-29 19:29:54 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
|
|
use Symfony\Component\HttpKernel\Kernel;
|
2021-11-08 12:24:51 +01:00
|
|
|
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
2017-11-29 19:29:54 +01:00
|
|
|
use Symfony\Component\Routing\RouteCollectionBuilder;
|
|
|
|
|
2021-11-08 12:24:51 +01:00
|
|
|
class IntegrationTest extends TestCase
|
2017-11-29 19:29:54 +01:00
|
|
|
{
|
|
|
|
public function testServicesAvailable()
|
|
|
|
{
|
|
|
|
$kernel = new IntegrationKernel('dev', true);
|
|
|
|
$kernel->boot();
|
|
|
|
$container = $kernel->getContainer();
|
|
|
|
|
|
|
|
$this->assertInstanceOf(MarkdownParser::class, $container->get('markdown.parser'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class IntegrationKernel extends Kernel
|
|
|
|
{
|
|
|
|
use MicroKernelTrait;
|
|
|
|
|
|
|
|
private $cacheDir;
|
|
|
|
|
2021-11-30 13:32:02 +01:00
|
|
|
public function registerBundles(): iterable
|
2017-11-29 19:29:54 +01:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
new FrameworkBundle(),
|
|
|
|
new KnpMarkdownBundle(),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2021-11-08 12:24:51 +01:00
|
|
|
protected function configureRoutes(RoutingConfigurator $routes)
|
2017-11-29 19:29:54 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
|
|
|
|
{
|
2021-11-08 12:24:51 +01:00
|
|
|
|
|
|
|
$c->loadFromExtension('framework', [
|
|
|
|
'secret' => 'F00',
|
|
|
|
'router' => ['utf8' => true]
|
|
|
|
]);
|
2017-11-29 19:29:54 +01:00
|
|
|
}
|
|
|
|
|
2021-11-30 13:32:02 +01:00
|
|
|
public function getCacheDir(): string
|
2017-11-29 19:29:54 +01:00
|
|
|
{
|
|
|
|
if (null === $this->cacheDir) {
|
|
|
|
$this->cacheDir = sys_get_temp_dir().'/'.rand(100, 999);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->cacheDir;
|
|
|
|
}
|
|
|
|
}
|