@@ -99,13 +99,21 @@ public function testDefaultConfig($debug)
99
99
self ::assertSaneContainer ($ this ->getCompiledContainer ());
100
100
}
101
101
102
+ public function getDebugModes ()
103
+ {
104
+ return [
105
+ ['debug ' => false ],
106
+ ['debug ' => true ],
107
+ ];
108
+ }
109
+
102
110
/**
103
- * @dataProvider getDebugModes
111
+ * @dataProvider getToolbarConfig
104
112
*/
105
- public function testToolbarConfig ($ toolbarEnabled , $ interceptRedirects , $ listenerInjected , $ listenerEnabled )
113
+ public function testToolbarConfig (bool $ toolbarEnabled , bool $ listenerInjected , bool $ listenerEnabled )
106
114
{
107
115
$ extension = new WebProfilerExtension ();
108
- $ extension ->load ([['toolbar ' => $ toolbarEnabled, ' intercept_redirects ' => $ interceptRedirects ]], $ this ->container );
116
+ $ extension ->load ([['toolbar ' => $ toolbarEnabled ]], $ this ->container );
109
117
$ this ->container ->removeDefinition ('web_profiler.controller.exception ' );
110
118
111
119
$ this ->assertSame ($ listenerInjected , $ this ->container ->has ('web_profiler.debug_toolbar ' ));
@@ -117,13 +125,70 @@ public function testToolbarConfig($toolbarEnabled, $interceptRedirects, $listene
117
125
}
118
126
}
119
127
120
- public function getDebugModes ()
128
+ public function getToolbarConfig ()
129
+ {
130
+ return [
131
+ [
132
+ 'toolbarEnabled ' => false ,
133
+ 'listenerInjected ' => false ,
134
+ 'listenerEnabled ' => false ,
135
+ ],
136
+ [
137
+ 'toolbarEnabled ' => true ,
138
+ 'listenerInjected ' => true ,
139
+ 'listenerEnabled ' => true ,
140
+ ],
141
+ ];
142
+ }
143
+
144
+ /**
145
+ * @group legacy
146
+ *
147
+ * @dataProvider getInterceptRedirectsToolbarConfig
148
+ */
149
+ public function testToolbarConfigUsingInterceptRedirects (
150
+ bool $ toolbarEnabled ,
151
+ bool $ interceptRedirects ,
152
+ bool $ listenerInjected ,
153
+ bool $ listenerEnabled
154
+ ) {
155
+ $ extension = new WebProfilerExtension ();
156
+ $ extension ->load (
157
+ [['toolbar ' => $ toolbarEnabled , 'intercept_redirects ' => $ interceptRedirects ]],
158
+ $ this ->container
159
+ );
160
+ $ this ->container ->removeDefinition ('web_profiler.controller.exception ' );
161
+
162
+ $ this ->assertSame ($ listenerInjected , $ this ->container ->has ('web_profiler.debug_toolbar ' ));
163
+
164
+ self ::assertSaneContainer ($ this ->getCompiledContainer (), '' , ['web_profiler.csp.handler ' ]);
165
+
166
+ if ($ listenerInjected ) {
167
+ $ this ->assertSame ($ listenerEnabled , $ this ->container ->get ('web_profiler.debug_toolbar ' )->isEnabled ());
168
+ }
169
+ }
170
+
171
+ public function getInterceptRedirectsToolbarConfig ()
121
172
{
122
173
return [
123
- [false , false , false , false ],
124
- [true , false , true , true ],
125
- [false , true , true , false ],
126
- [true , true , true , true ],
174
+ [
175
+ 'toolbarEnabled ' => false ,
176
+ 'interceptRedirects ' => true ,
177
+ 'listenerInjected ' => true ,
178
+ 'listenerEnabled ' => false ,
179
+ ],
180
+ [
181
+ 'toolbarEnabled ' => false ,
182
+ 'interceptRedirects ' => false ,
183
+ 'listenerInjected ' => false ,
184
+ 'listenerEnabled ' => false ,
185
+ ],
186
+ [
187
+ 'toolbarEnabled ' => true ,
188
+ 'interceptRedirects ' => true ,
189
+ 'listenerInjected ' => true ,
190
+ 'listenerEnabled ' => true ,
191
+ ],
127
192
];
128
193
}
129
194
0 commit comments