1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Knp\Bundle\SnappyBundle\Tests\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use PHPUnit\Framework\TestCase; |
6
|
|
|
use Symfony\Component\Config\Definition\Processor; |
7
|
|
|
|
8
|
|
|
class ConfigurationTest extends TestCase |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @dataProvider dataForProcessedConfiguration |
12
|
|
|
*/ |
13
|
|
|
public function testProcessedConfiguration($configs, $expectedConfig) |
14
|
|
|
{ |
15
|
|
|
$processor = new Processor(); |
16
|
|
|
$configuration = new Configuration(); |
17
|
|
|
$config = $processor->processConfiguration($configuration, $configs); |
18
|
|
|
|
19
|
|
|
$this->assertEquals($expectedConfig, $config); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function dataForProcessedConfiguration() |
23
|
|
|
{ |
24
|
|
|
return [ |
25
|
|
|
[ |
26
|
|
|
[], |
27
|
|
|
[ |
28
|
|
|
'pdf' => [ |
29
|
|
|
'enabled' => true, |
30
|
|
|
'binary' => 'wkhtmltopdf', |
31
|
|
|
'options' => [], |
32
|
|
|
'env' => [], |
33
|
|
|
], |
34
|
|
|
'image' => [ |
35
|
|
|
'enabled' => true, |
36
|
|
|
'binary' => 'wkhtmltoimage', |
37
|
|
|
'options' => [], |
38
|
|
|
'env' => [], |
39
|
|
|
], |
40
|
|
|
], |
41
|
|
|
], |
42
|
|
|
[ |
43
|
|
|
[ |
44
|
|
|
[ |
45
|
|
|
'pdf' => [ |
46
|
|
|
'binary' => '/path/to/wkhtmltopdf', |
47
|
|
|
'options' => ['foo' => 'bar'], |
48
|
|
|
'env' => [], |
49
|
|
|
], |
50
|
|
|
'image' => [ |
51
|
|
|
'binary' => '/path/to/wkhtmltoimage', |
52
|
|
|
'options' => ['baz' => 'bat', 'baf' => 'bag'], |
53
|
|
|
'env' => [], |
54
|
|
|
], |
55
|
|
|
], |
56
|
|
|
[ |
57
|
|
|
'pdf' => [ |
58
|
|
|
'options' => ['bak' => 'bap'], |
59
|
|
|
'env' => [], |
60
|
|
|
], |
61
|
|
|
], |
62
|
|
|
], |
63
|
|
|
[ |
64
|
|
|
'pdf' => [ |
65
|
|
|
'enabled' => true, |
66
|
|
|
'binary' => '/path/to/wkhtmltopdf', |
67
|
|
|
'options' => ['bak' => 'bap'], |
68
|
|
|
'env' => [], |
69
|
|
|
], |
70
|
|
|
'image' => [ |
71
|
|
|
'enabled' => true, |
72
|
|
|
'binary' => '/path/to/wkhtmltoimage', |
73
|
|
|
'options' => ['baz' => 'bat', 'baf' => 'bag'], |
74
|
|
|
'env' => [], |
75
|
|
|
], |
76
|
|
|
], |
77
|
|
|
], |
78
|
|
|
[ |
79
|
|
|
[ |
80
|
|
|
['pdf' => ['enabled' => false]], |
81
|
|
|
], |
82
|
|
|
[ |
83
|
|
|
'pdf' => [ |
84
|
|
|
'enabled' => false, |
85
|
|
|
'binary' => 'wkhtmltopdf', |
86
|
|
|
'options' => [], |
87
|
|
|
'env' => [], |
88
|
|
|
], |
89
|
|
|
'image' => [ |
90
|
|
|
'enabled' => true, |
91
|
|
|
'binary' => 'wkhtmltoimage', |
92
|
|
|
'options' => [], |
93
|
|
|
'env' => [], |
94
|
|
|
], |
95
|
|
|
], |
96
|
|
|
], |
97
|
|
|
[ |
98
|
|
|
[ |
99
|
|
|
[ |
100
|
|
|
'pdf' => [ |
101
|
|
|
'options' => [ |
102
|
|
|
'foo-bar' => 'baz', |
103
|
|
|
], |
104
|
|
|
'env' => [], |
105
|
|
|
], |
106
|
|
|
'image' => [ |
107
|
|
|
'options' => [ |
108
|
|
|
'bag-baf' => 'bak', |
109
|
|
|
], |
110
|
|
|
'env' => [], |
111
|
|
|
], |
112
|
|
|
], |
113
|
|
|
], |
114
|
|
|
[ |
115
|
|
|
'pdf' => [ |
116
|
|
|
'enabled' => true, |
117
|
|
|
'binary' => 'wkhtmltopdf', |
118
|
|
|
'options' => [ |
119
|
|
|
'foo-bar' => 'baz', |
120
|
|
|
], |
121
|
|
|
'env' => [], |
122
|
|
|
], |
123
|
|
|
'image' => [ |
124
|
|
|
'enabled' => true, |
125
|
|
|
'binary' => 'wkhtmltoimage', |
126
|
|
|
'options' => [ |
127
|
|
|
'bag-baf' => 'bak', |
128
|
|
|
], |
129
|
|
|
'env' => [], |
130
|
|
|
], |
131
|
|
|
], |
132
|
|
|
], |
133
|
|
|
[ |
134
|
|
|
[ |
135
|
|
|
[ |
136
|
|
|
'process_timeout' => 120, |
137
|
|
|
], |
138
|
|
|
], |
139
|
|
|
[ |
140
|
|
|
'process_timeout' => 120, |
141
|
|
|
'pdf' => [ |
142
|
|
|
'enabled' => true, |
143
|
|
|
'binary' => 'wkhtmltopdf', |
144
|
|
|
'options' => [], |
145
|
|
|
'env' => [], |
146
|
|
|
], |
147
|
|
|
'image' => [ |
148
|
|
|
'enabled' => true, |
149
|
|
|
'binary' => 'wkhtmltoimage', |
150
|
|
|
'options' => [], |
151
|
|
|
'env' => [], |
152
|
|
|
], |
153
|
|
|
], |
154
|
|
|
], |
155
|
|
|
]; |
156
|
|
|
} |
157
|
|
|
} |
158
|
|
|
|