Completed
Pull Request — 2.x (#233)
by Andrey F.
02:02
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
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[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 Sonata\TranslationBundle\Tests\DependencyInjection;
13
14
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
15
use Sonata\TranslationBundle\DependencyInjection\SonataTranslationExtension;
16
17
/**
18
 * @author Oskar Stark <[email protected]>
19
 */
20
final class SonataTranslationExtensionTest extends AbstractExtensionTestCase
21
{
22
    public function testLoadServiceDefinitionWhenSonataDoctrineORMAdminBundleBundleIsRegistered()
23
    {
24
        $this->container->setParameter('kernel.bundles', ['SonataDoctrineORMAdminBundle' => 'whatever']);
25
        $this->load();
26
        $this->assertContainerBuilderHasService(
27
            'sonata_translation.checker.translatable',
28
            'Sonata\TranslationBundle\Checker\TranslatableChecker'
29
        );
30
        $this->assertContainerBuilderHasService(
31
            'sonata_translation.filter.type.translation_field',
32
            'Sonata\TranslationBundle\Filter\TranslationFieldFilter'
33
        );
34
    }
35
36
    public function testLoadServiceDefinitionNoCheckerTranslatable()
37
    {
38
        $this->container->setParameter('kernel.bundles', []);
39
        $this->load();
40
41
        $this->assertContainerBuilderNotHasService('sonata_translation.checker.translatable');
42
    }
43
44
    protected function getContainerExtensions()
45
    {
46
        return [new SonataTranslationExtension()];
47
    }
48
}
49