Completed
Push — master ( 285e3a...2088cc )
by Emily
02:40
created

ConfigurationTest::testManyMailersAreProcessed()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 36
rs 8.8571
c 1
b 0
f 0
cc 1
eloc 22
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the pixelart Swiftmailer manipulator bundle.
5
 *
6
 * (c) pixelart GmbH
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 DependencyInjection;
13
14
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
15
use Pixelart\Bundle\SwiftmailerManipulatorBundle\DependencyInjection\Configuration;
16
17
class ConfigurationTest extends \PHPUnit_Framework_TestCase
18
{
19
    use ConfigurationTestCaseTrait;
20
21
    public function testEmptyConfigurationIsEmpty()
22
    {
23
        $this->assertProcessedConfigurationEquals([
24
            [],
25
        ], [
26
            'mailers' => [],
27
        ]);
28
    }
29
30
    public function testFullConfigurationIsProcessed()
31
    {
32
        $this->assertProcessedConfigurationEquals([
33
            [
34
                'prepend_subject' => '[TESTSYSTEM!]',
35
                'prepend_body' => 'swiftmailer/prepend_body.txt.twig',
36
            ],
37
        ], [
38
            'mailers' => [
39
                'default' => [
40
                    'prepend_subject' => '[TESTSYSTEM!]',
41
                    'prepend_body' => 'swiftmailer/prepend_body.txt.twig',
42
                ],
43
            ],
44
        ]);
45
    }
46
47
    public function testOneMailerIsProcessed()
48
    {
49
        $this->assertProcessedConfigurationEquals([
50
            [
51
                'mailers' => [
52
                    'main_mailer' => [
53
                        'prepend_subject' => '[TESTSYSTEM!]',
54
                        'prepend_body' => 'swiftmailer/prepend_body.txt.twig',
55
                    ],
56
                ],
57
            ],
58
        ], [
59
            'mailers' => [
60
                'main_mailer' => [
61
                    'prepend_subject' => '[TESTSYSTEM!]',
62
                    'prepend_body' => 'swiftmailer/prepend_body.txt.twig',
63
                ],
64
            ],
65
        ]);
66
    }
67
68
    public function testManyMailersAreProcessed()
69
    {
70
        $this->assertProcessedConfigurationEquals([
71
            [
72
                'mailers' => [
73
                    'first_mailer' => [
74
                        'prepend_subject' => '[TESTSYSTEM 1!]',
75
                        'prepend_body' => 'swiftmailer/prepend_body_1.txt.twig',
76
                    ],
77
                    'secondary_mailer' => [
78
                        'prepend_subject' => '[TESTSYSTEM 2!]',
79
                        'prepend_body' => 'swiftmailer/prepend_body_2.txt.twig',
80
                    ],
81
                    'third_mailer' => [
82
                        'prepend_subject' => '[TESTSYSTEM 3!]',
83
                        'prepend_body' => 'swiftmailer/prepend_body_3.txt.twig',
84
                    ],
85
                ],
86
            ],
87
        ], [
88
            'mailers' => [
89
                'first_mailer' => [
90
                    'prepend_subject' => '[TESTSYSTEM 1!]',
91
                    'prepend_body' => 'swiftmailer/prepend_body_1.txt.twig',
92
                ],
93
                'secondary_mailer' => [
94
                    'prepend_subject' => '[TESTSYSTEM 2!]',
95
                    'prepend_body' => 'swiftmailer/prepend_body_2.txt.twig',
96
                ],
97
                'third_mailer' => [
98
                    'prepend_subject' => '[TESTSYSTEM 3!]',
99
                    'prepend_body' => 'swiftmailer/prepend_body_3.txt.twig',
100
                ],
101
            ],
102
        ]);
103
    }
104
105
    protected function getConfiguration()
106
    {
107
        return new Configuration();
108
    }
109
}
110