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