Completed
Push — master ( bcf7a5...7b0e41 )
by Christophe
21s queued 11s
created

TestKernel::getProjectDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
namespace Incenteev\TranslationCheckerBundle\Tests\FixtureApp;
4
5
use Incenteev\TranslationCheckerBundle\IncenteevTranslationCheckerBundle;
6
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
7
use Symfony\Component\Config\Loader\LoaderInterface;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\HttpKernel\Kernel;
10
11
class TestKernel extends Kernel
12
{
13
    public function registerBundles()
14
    {
15
        return array(
16
            new FrameworkBundle(),
17
            new IncenteevTranslationCheckerBundle(),
18
        );
19
    }
20
21
    public function registerContainerConfiguration(LoaderInterface $loader)
22
    {
23
        $loader->load(function (ContainerBuilder $container) {
24
            $container->loadFromExtension('framework', array(
25
                'translator' => array('fallback' => 'en'),
26
                'secret' => 'test',
27
            ));
28
            // Register a NullLogger to avoid getting the stderr default logger of FrameworkBundle
29
            $container->register('logger', 'Psr\Log\NullLogger');
30
        });
31
    }
32
33
    public function getProjectDir()
34
    {
35
        // Fake implementation so that the old root_dir/Resources/translations and the new project_dir/translations both
36
        // map to the same folder in our fixture app to avoid getting a deprecation warning when running tests with 4.2+
37
        // but keeping compat with running tests on 3.4.
38
        return __DIR__.'/Resources';
39
    }
40
41
    public function getCacheDir()
42
    {
43
        return sys_get_temp_dir().'/incenteev_translation_checker';
44
    }
45
46
    public function getLogDir()
47
    {
48
        return $this->getCacheDir();
49
    }
50
}
51