Completed
Pull Request — 3.x (#609)
by Wojciech
08:42
created

AppKernel::getProjectDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\NewsBundle\Tests\App;
15
16
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
17
use JMS\SerializerBundle\JMSSerializerBundle;
18
use Knp\Bundle\MenuBundle\KnpMenuBundle;
19
use Sonata\BlockBundle\SonataBlockBundle;
20
use Sonata\ClassificationBundle\SonataClassificationBundle;
21
use Sonata\Doctrine\Bridge\Symfony\Bundle\SonataDoctrineBundle;
22
use Sonata\Form\Bridge\Symfony\SonataFormBundle;
23
use Sonata\IntlBundle\SonataIntlBundle;
24
use Sonata\MediaBundle\SonataMediaBundle;
25
use Sonata\NewsBundle\SonataNewsBundle;
26
use Sonata\Twig\Bridge\Symfony\SonataTwigBundle;
27
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
28
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
29
use Symfony\Bundle\SecurityBundle\SecurityBundle;
30
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;
31
use Symfony\Bundle\TwigBundle\TwigBundle;
32
use Symfony\Component\Config\Loader\LoaderInterface;
33
use Symfony\Component\DependencyInjection\ContainerBuilder;
34
use Symfony\Component\HttpKernel\Kernel;
35
use Symfony\Component\Routing\RouteCollectionBuilder;
36
37
final class AppKernel extends Kernel
38
{
39
    use MicroKernelTrait;
40
41
    public function __construct()
42
    {
43
        parent::__construct('test', false);
44
    }
45
46
    public function registerBundles()
47
    {
48
        return [
49
            new FrameworkBundle(),
50
            new TwigBundle(),
51
            new SecurityBundle(),
52
            new DoctrineBundle(),
53
            new KnpMenuBundle(),
54
            new SonataBlockBundle(),
55
            new SonataDoctrineBundle(),
56
            new SonataFormBundle(),
57
            new SonataTwigBundle(),
58
            new SonataClassificationBundle(),
59
            new SonataIntlBundle(),
60
            new SonataMediaBundle(),
61
            new SonataNewsBundle(),
62
            new JMSSerializerBundle(),
63
            new SwiftmailerBundle(),
64
        ];
65
    }
66
67
    public function getCacheDir(): string
68
    {
69
        return $this->getBaseDir().'cache';
70
    }
71
72
    public function getLogDir(): string
73
    {
74
        return $this->getBaseDir().'log';
75
    }
76
77
    public function getProjectDir()
78
    {
79
        return __DIR__;
80
    }
81
82
    protected function configureRoutes(RouteCollectionBuilder $routes)
83
    {
84
        $routes->import($this->getProjectDir().'/config/routes.yaml');
85
    }
86
87
    protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader)
0 ignored issues
show
Unused Code introduced by
The parameter $containerBuilder is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
88
    {
89
        $loader->load($this->getProjectDir().'/config/config.yaml');
90
    }
91
92
    private function getBaseDir(): string
93
    {
94
        return sys_get_temp_dir().'/sonata-news-bundle/var/';
95
    }
96
}
97