Completed
Pull Request — master (#1691)
by
unknown
10:37 queued 08:04
created

AppKernel::getLogDir()   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\MediaBundle\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 Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;
21
use Sonata\MediaBundle\SonataMediaBundle;
22
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
23
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
24
use Symfony\Bundle\SecurityBundle\SecurityBundle;
25
use Symfony\Bundle\TwigBundle\TwigBundle;
26
use Symfony\Component\Config\Loader\LoaderInterface;
27
use Symfony\Component\DependencyInjection\ContainerBuilder;
28
use Symfony\Component\HttpKernel\Kernel;
29
use Symfony\Component\Routing\RouteCollectionBuilder;
30
31
final class AppKernel extends Kernel
32
{
33
    use MicroKernelTrait;
34
35
    public function __construct()
36
    {
37
        parent::__construct('test', false);
38
    }
39
40
    public function registerBundles()
41
    {
42
        return [
43
            new FrameworkBundle(),
44
            new SecurityBundle(),
45
            new TwigBundle(),
46
            new FOSRestBundle(),
47
            new SonataMediaBundle(),
48
            new JMSSerializerBundle(),
49
            new DoctrineBundle(),
50
            new NelmioApiDocBundle(),
51
            new SensioFrameworkExtraBundle(),
52
        ];
53
    }
54
55
    public function getCacheDir(): string
56
    {
57
        return $this->getBaseDir().'cache';
58
    }
59
60
    public function getLogDir(): string
61
    {
62
        return $this->getBaseDir().'log';
63
    }
64
65
    public function getProjectDir(): string
66
    {
67
        return __DIR__;
68
    }
69
70
    protected function configureRoutes(RouteCollectionBuilder $routes)
71
    {
72
        $routes->import(__DIR__.'/routes.yml', '/', 'yaml');
73
    }
74
75
    protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader)
76
    {
77
        $loader->load(__DIR__.'/config.yml');
78
        $loader->load(__DIR__.'/security.yml');
79
        $containerBuilder->setParameter('app.base_dir', $this->getBaseDir());
80
    }
81
82
    private function getBaseDir(): string
83
    {
84
        return sys_get_temp_dir().'/sonata-media-bundle/var/';
85
    }
86
}
87