Completed
Push — master ( b8cd4e...ae6a8d )
by Simonas
8s
created

ProviderPassTest::testProcess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 2 Features 2
Metric Value
c 4
b 2
f 2
dl 0
loc 21
rs 9.3142
cc 1
eloc 15
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[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 ONGR\SettingsBundle\Tests\Functional\DependencyInjection\Compiler;
13
14
use ONGR\SettingsBundle\DependencyInjection\Compiler\ProviderPass;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Definition;
17
18
class ProviderPassTest extends \PHPUnit_Framework_TestCase
19
{
20
    /**
21
     * Test for process().
22
     */
23
    public function testProcess()
24
    {
25
        $container = new ContainerBuilder();
26
        $container->setDefinition('ongr_settings.settings_container', new Definition());
27
        $container->setParameter('ongr_settings.settings_container.profiles', ['default', 'custom']);
28
        $container->setParameter('ongr_settings.connection.repository', 'es.manager.setting');
29
30
        $definition = new Definition();
31
        $definition->addTag('ongr_settings.ongr_settings', ['profile' => 'custom']);
32
        $container->setDefinition('ongr_settings.custom_settings_provider', $definition);
33
34
        $definition = new Definition();
35
        $definition->addTag('ongr_settings.settings_provider');
36
        $container->setDefinition('ongr_settings.unregistered_settings_provider', $definition);
37
38
        $pass = new ProviderPass();
39
        $pass->process($container);
40
41
        $methodCalls = $container->getDefinition('ongr_settings.settings_container')->getMethodCalls();
42
        $this->assertCount(3, $methodCalls);
43
    }
44
}
45