Passed
Push — master ( d2e487...b38026 )
by Tobias
05:31
created

BundleInitializationTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A testRegisterBundle() 0 25 3
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Translation\Bundle\Tests\Functional;
13
14
use Translation\Bundle\Catalogue\CatalogueFetcher;
15
use Translation\Bundle\Catalogue\CatalogueManager;
16
use Translation\Bundle\Catalogue\CatalogueWriter;
17
use Translation\Bundle\Service\ConfigurationManager;
18
use Translation\Bundle\Service\StorageService;
19
20
class BundleInitializationTest extends BaseTestCase
21
{
22
    public function testRegisterBundle(): void
23
    {
24
        $this->bootKernel();
25
        $container = $this->getContainer();
26
        $this->assertTrue($container->has(ConfigurationManager::class));
27
        $config = $container->get(ConfigurationManager::class);
28
        $this->assertInstanceOf(ConfigurationManager::class, $config);
29
30
        $default = $config->getConfiguration();
31
        $root = $container->getParameter('kernel.project_dir');
32
        $this->assertEquals($root.'/Resources/translations', $default->getOutputDir());
33
34
        $services = [
35
            CatalogueFetcher::class,
36
            CatalogueManager::class,
37
            CatalogueWriter::class,
38
            'php_translation.storage' => StorageService::class,
39
        ];
40
41
        foreach ($services as $id => $class) {
42
            $id = \is_int($id) ? $class : $id;
43
44
            $this->assertTrue($container->has($id));
45
            $s = $container->get($id);
46
            $this->assertInstanceOf($class, $s);
47
        }
48
    }
49
}
50