Completed
Pull Request — master (#158)
by
unknown
03:19
created

ProviderPassTest::testProcess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 21
Ratio 100 %

Importance

Changes 3
Bugs 2 Features 2
Metric Value
c 3
b 2
f 2
dl 21
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\Unit\DependencyInjection\Compiler;
13
14
use ONGR\SettingsBundle\DependencyInjection\Compiler\ProviderPass;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Definition;
17
18 View Code Duplication
class ProviderPassTest extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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.default.setting');
29
30
        $definition = new Definition();
31
        $definition->addTag('ongr_settings.settings_provider', ['profile' => 'custom', 'priority' => 9]);
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