Completed
Push — master ( eaaca4...7cda52 )
by
unknown
14s queued 11s
created

ConfigurationTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 68
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testDefaultOptions() 0 13 1
A testCustomTemplates() 0 30 1
A testTemplateTypesWithInvalidValues() 0 13 1
A getConfiguration() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\DoctrineMongoDBAdminBundle\Tests\DependencyInjection;
15
16
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
17
use PHPUnit\Framework\TestCase;
18
use Sonata\DoctrineMongoDBAdminBundle\DependencyInjection\Configuration;
19
20
class ConfigurationTest extends TestCase
21
{
22
    use ConfigurationTestCaseTrait;
23
24
    public function testDefaultOptions(): void
25
    {
26
        $this->assertProcessedConfigurationEquals([], [
27
            'templates' => [
28
                'form' => [
29
                    '@SonataDoctrineMongoDBAdmin/Form/form_admin_fields.html.twig',
30
                ],
31
                'filter' => [
32
                    '@SonataDoctrineMongoDBAdmin/Form/filter_admin_fields.html.twig',
33
                ],
34
            ],
35
        ]);
36
    }
37
38
    public function testCustomTemplates(): void
39
    {
40
        $this->assertProcessedConfigurationEquals([[
41
            'templates' => [
42
                'form' => ['form.twig.html', 'form_extra.twig.html'],
43
                'filter' => ['filter.twig.html'],
44
                'types' => [
45
                    'list' => [
46
                        'array' => 'list_array.twig.html',
47
                    ],
48
                    'show' => [
49
                        'array' => 'show_array.twig.html',
50
                    ],
51
                ],
52
            ],
53
        ]], [
54
            'templates' => [
55
                'form' => ['form.twig.html', 'form_extra.twig.html'],
56
                'filter' => ['filter.twig.html'],
57
                'types' => [
58
                    'list' => [
59
                        'array' => 'list_array.twig.html',
60
                    ],
61
                    'show' => [
62
                        'array' => 'show_array.twig.html',
63
                    ],
64
                ],
65
            ],
66
        ]);
67
    }
68
69
    public function testTemplateTypesWithInvalidValues(): void
70
    {
71
        $this->assertConfigurationIsInvalid(
72
            [[
73
                'templates' => [
74
                    'types' => [
75
                        'edit' => [],
76
                    ],
77
                ],
78
            ]],
79
            'edit'
80
        );
81
    }
82
83
    protected function getConfiguration(): Configuration
84
    {
85
        return new Configuration();
86
    }
87
}
88