Completed
Push — master ( 9b32c1...6dc3e3 )
by
unknown
02:03
created

testLoadServiceDefinitionNoCheckerTranslatable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
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\TranslationBundle\Tests\DependencyInjection;
15
16
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
17
use Sonata\TranslationBundle\DependencyInjection\SonataTranslationExtension;
18
19
/**
20
 * @author Oskar Stark <[email protected]>
21
 */
22
final class SonataTranslationExtensionTest extends AbstractExtensionTestCase
23
{
24
    public function testLoadServiceDefinitionWhenSonataDoctrineORMAdminBundleBundleIsRegistered(): void
25
    {
26
        $this->container->setParameter('kernel.bundles', ['SonataDoctrineORMAdminBundle' => 'whatever']);
27
        $this->load();
28
        $this->assertContainerBuilderHasService(
29
            'sonata_translation.checker.translatable',
30
            'Sonata\TranslationBundle\Checker\TranslatableChecker'
31
        );
32
        $this->assertContainerBuilderHasService(
33
            'sonata_translation.filter.type.translation_field',
34
            'Sonata\TranslationBundle\Filter\TranslationFieldFilter'
35
        );
36
    }
37
38
    public function testLoadServiceDefinitionNoCheckerTranslatable()
39
    {
40
        $this->container->setParameter('kernel.bundles', []);
41
        $this->load();
42
43
        $this->assertContainerBuilderNotHasService('sonata_translation.checker.translatable');
44
    }
45
46
    protected function getContainerExtensions()
47
    {
48
        return [new SonataTranslationExtension()];
49
    }
50
}
51