Completed
Pull Request — 3.x (#457)
by Wojciech
07:17
created

AppKernel::configureContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\NotificationBundle\Tests\App;
15
16
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
17
use FOS\RestBundle\FOSRestBundle;
18
use JMS\SerializerBundle\JMSSerializerBundle;
19
use Nelmio\ApiDocBundle\NelmioApiDocBundle;
20
use Sonata\Doctrine\Bridge\Symfony\SonataDoctrineBundle;
21
use Sonata\NotificationBundle\SonataNotificationBundle;
22
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
23
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
24
use Symfony\Bundle\SecurityBundle\SecurityBundle;
25
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;
26
use Symfony\Bundle\TwigBundle\TwigBundle;
27
use Symfony\Component\Config\Loader\LoaderInterface;
28
use Symfony\Component\DependencyInjection\ContainerBuilder;
29
use Symfony\Component\HttpKernel\Kernel;
30
use Symfony\Component\Routing\RouteCollectionBuilder;
31
32
final class AppKernel extends Kernel
33
{
34
    use MicroKernelTrait;
35
36
    public function __construct()
37
    {
38
        parent::__construct('test', false);
39
    }
40
41
    public function registerBundles()
42
    {
43
        return [
44
            new FrameworkBundle(),
45
            new SecurityBundle(),
46
            new TwigBundle(),
47
            new FOSRestBundle(),
48
            new SonataDoctrineBundle(),
49
            new SonataNotificationBundle(),
50
            new JMSSerializerBundle(),
51
            new DoctrineBundle(),
52
            new NelmioApiDocBundle(),
53
            new SwiftmailerBundle(),
54
        ];
55
    }
56
57
    public function getCacheDir(): string
58
    {
59
        return $this->getBaseDir().'cache';
60
    }
61
62
    public function getLogDir(): string
63
    {
64
        return $this->getBaseDir().'log';
65
    }
66
67
    public function getProjectDir(): string
68
    {
69
        return __DIR__;
70
    }
71
72
    protected function configureRoutes(RouteCollectionBuilder $routes)
73
    {
74
        $routes->import($this->getProjectDir().'/config/routes.yaml');
75
    }
76
77
    protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
78
    {
79
        $loader->load(__DIR__.'/config/config.yml');
80
        $loader->load(__DIR__.'/config/security.yml');
81
82
        $containerBuilder->setParameter('app.base_dir', $this->getBaseDir());
83
    }
84
85
    private function getBaseDir(): string
86
    {
87
        return sys_get_temp_dir().'/sonata-notification-bundle/var/11aaasdqwedqweqdqwqwd';
88
    }
89
}
90