ConfigurationTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 22
c 1
b 0
f 0
dl 0
loc 44
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testProcessedConfiguration() 0 6 1
A dataForProcessedConfiguration() 0 31 1
1
<?php declare(strict_types=1);
2
3
namespace Karser\Recaptcha3Bundle\Tests\DependencyInjection;
4
5
use Karser\Recaptcha3Bundle\DependencyInjection\Configuration;
6
use PHPUnit\Framework\TestCase;
7
use Symfony\Component\Config\Definition\Processor;
8
9
class ConfigurationTest extends TestCase
10
{
11
    /**
12
     * @dataProvider dataForProcessedConfiguration
13
     */
14
    public function testProcessedConfiguration($configs, $expectedConfig)
15
    {
16
        $processor = new Processor();
17
        $configuration = new Configuration();
18
        $config = $processor->processConfiguration($configuration, $configs);
19
        self::assertSame($expectedConfig, $config);
20
    }
21
22
    public function dataForProcessedConfiguration()
23
    {
24
        return [
25
            [
26
                [
27
                    'karser_recaptcha3' => [
28
                        'site_key' => 'key',
29
                        'secret_key' => 'secret',
30
                    ]
31
                ],
32
                [
33
                    'site_key' => 'key',
34
                    'secret_key' => 'secret',
35
                    'score_threshold' => 0.5,
36
                    'enabled' => true,
37
                ],
38
            ],
39
            [
40
                [
41
                    'karser_recaptcha3' => [
42
                        'site_key' => 'key',
43
                        'secret_key' => 'secret',
44
                        'score_threshold' => 0.7,
45
                        'enabled' => false,
46
                    ]
47
                ],
48
                [
49
                    'site_key' => 'key',
50
                    'secret_key' => 'secret',
51
                    'score_threshold' => 0.7,
52
                    'enabled' => false,
53
                ],
54
            ],
55
        ];
56
    }
57
}
58