Failed Conditions
Pull Request — master (#790)
by Guilherme
07:57
created

PROCERGSPhoneVerificationExtensionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 41
ccs 0
cts 34
cp 0
rs 10
c 0
b 0
f 0
wmc 3
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
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 PROCERGS\LoginCidadao\PhoneVerificationBundle\Tests\DependencyInjection;
12
13
use PHPUnit\Framework\TestCase;
14
use PROCERGS\LoginCidadao\PhoneVerificationBundle\DependencyInjection\PROCERGSPhoneVerificationExtension;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
17
18
class PROCERGSPhoneVerificationExtensionTest extends TestCase
19
{
20
    private function createContainer()
21
    {
22
        $container = new ContainerBuilder(
23
            new ParameterBag(
24
                [
25
                    'kernel.cache_dir' => __DIR__,
26
                    'kernel.root_dir' => __DIR__.'/Fixtures',
27
                    'kernel.charset' => 'UTF-8',
28
                    'kernel.debug' => false,
29
                ]
30
            )
31
        );
32
33
        return $container;
34
    }
35
36
    private function compileContainer(ContainerBuilder $container)
37
    {
38
        $container->getCompilerPassConfig()->setOptimizationPasses([]);
39
        $container->getCompilerPassConfig()->setRemovingPasses([]);
40
        $container->compile();
41
    }
42
43
    public function testParametersLoaded()
44
    {
45
        $config = ConfigurationTest::getConfig(5, 20);
46
47
        $container = $this->createContainer();
48
        $container->registerExtension(new PROCERGSPhoneVerificationExtension());
49
        $container->loadFromExtension('procergs_phone_verification', $config);
50
        $this->compileContainer($container);
51
52
        $this->assertEquals(
53
            $config['max_failures'],
54
            $container->getParameter('procergs_phone_verification.max_failures')
55
        );
56
        $this->assertEquals(
57
            $config['reset_timeout'],
58
            $container->getParameter('procergs_phone_verification.reset_timeout')
59
        );
60
    }
61
}
62