Completed
Push — master ( db5e85...36b1aa )
by Artem
02:41
created

FreshDoctrineEnumExtensionTest::testLoadExtension()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 2
Metric Value
c 3
b 1
f 2
dl 0
loc 14
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
/*
3
 * This file is part of the FreshDoctrineEnumBundle
4
 *
5
 * (c) Artem Genvald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Fresh\DoctrineEnumBundle\Tests\DependencyInjection;
12
13
use Fresh\DoctrineEnumBundle\DependencyInjection\FreshDoctrineEnumExtension;
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
16
/**
17
 * FreshDoctrineEnumExtensionTest.
18
 *
19
 * @author Artem Genvald <[email protected]>
20
 */
21
class FreshDoctrineEnumExtensionTest extends \PHPUnit_Framework_TestCase
22
{
23
    /**
24
     * @var FreshDoctrineEnumExtension $extension FreshDoctrineEnumExtension
25
     */
26
    private $extension;
27
28
    /**
29
     * @var ContainerBuilder $container Container builder
30
     */
31
    private $container;
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    protected function setUp()
37
    {
38
        $this->extension = new FreshDoctrineEnumExtension();
39
        $this->container = new ContainerBuilder();
40
        $this->container->registerExtension($this->extension);
41
    }
42
43
    public function testLoadExtension()
44
    {
45
        // Add some dummy required parameter and service
46
        $this->container->setParameter('doctrine.dbal.connection_factory.types', null);
47
        $this->container->set('doctrine', new \StdClass());
48
49
        $this->container->loadFromExtension($this->extension->getAlias());
50
        $this->container->compile();
51
52
        // Check that services have been loaded
53
        $this->assertTrue($this->container->has('twig.extension.readable_enum_value'));
54
        $this->assertTrue($this->container->has('twig.extension.enum_constant'));
55
        $this->assertTrue($this->container->has('enum_type_guesser'));
56
    }
57
}
58