Completed
Push — 3.x ( 56238c...c5fe2a )
by Christian
02:51
created

AppKernel   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 12

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 12
dl 0
loc 60
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A registerBundles() 0 13 1
A getCacheDir() 0 4 1
A getLogDir() 0 4 1
A configureRoutes() 0 4 1
A configureContainer() 0 16 1
A getBaseDir() 0 4 1
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\AdminBundle\Tests\Functional;
15
16
use Knp\Bundle\MenuBundle\KnpMenuBundle;
17
use Sonata\AdminBundle\SonataAdminBundle;
18
use Sonata\BlockBundle\SonataBlockBundle;
19
use Sonata\CoreBundle\SonataCoreBundle;
20
use Sonata\Doctrine\Bridge\Symfony\Bundle\SonataDoctrineBundle;
21
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
22
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
23
use Symfony\Bundle\SecurityBundle\SecurityBundle;
24
use Symfony\Bundle\TwigBundle\TwigBundle;
25
use Symfony\Component\Config\Loader\LoaderInterface;
26
use Symfony\Component\DependencyInjection\ContainerBuilder;
27
use Symfony\Component\HttpKernel\Kernel;
28
use Symfony\Component\Routing\RouteCollectionBuilder;
29
30
final class AppKernel extends Kernel
31
{
32
    use MicroKernelTrait;
33
34
    public function __construct()
35
    {
36
        parent::__construct('test', false);
37
    }
38
39
    public function registerBundles()
40
    {
41
        return [
42
            new FrameworkBundle(),
43
            new TwigBundle(),
44
            new SecurityBundle(),
45
            new KnpMenuBundle(),
46
            new SonataBlockBundle(),
47
            new SonataCoreBundle(),
48
            new SonataDoctrineBundle(),
49
            new SonataAdminBundle(),
50
        ];
51
    }
52
53
    public function getCacheDir(): string
54
    {
55
        return $this->getBaseDir().'cache';
56
    }
57
58
    public function getLogDir(): string
59
    {
60
        return $this->getBaseDir().'log';
61
    }
62
63
    protected function configureRoutes(RouteCollectionBuilder $routes)
64
    {
65
        $routes->import(__DIR__.'/../../src/Resources/config/routing/sonata_admin.xml');
66
    }
67
68
    protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader)
0 ignored issues
show
Unused Code introduced by
The parameter $loader 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...
69
    {
70
        $containerBuilder->loadFromExtension('framework', [
71
            'secret' => 'MySecret',
72
            'trusted_proxies' => [],
73
            'fragments' => ['enabled' => true],
74
            'form' => ['enabled' => true],
75
            'session' => ['handler_id' => null, 'storage_id' => 'session.storage.mock_file', 'name' => 'MOCKSESSID'],
76
            'templating' => ['engine' => ['twig']],
77
        ]);
78
79
        $containerBuilder->loadFromExtension('security', [
80
            'firewalls' => ['main' => ['anonymous' => true]],
81
            'providers' => ['in_memory' => ['memory' => null]],
82
        ]);
83
    }
84
85
    private function getBaseDir(): string
86
    {
87
        return sys_get_temp_dir().'/sonata-admin-bundle/var/';
88
    }
89
}
90