@@ -99,15 +99,64 @@ 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
+
110
+ /**
111
+ * @dataProvider getToolbarConfig
112
+ */
113
+ public function testToolbarConfig (bool $ toolbarEnabled , bool $ listenerInjected , bool $ listenerEnabled )
114
+ {
115
+ $ extension = new WebProfilerExtension ();
116
+ $ extension ->load ([['toolbar ' => $ toolbarEnabled ]], $ this ->container );
117
+ $ this ->container ->removeDefinition ('web_profiler.controller.exception ' );
118
+
119
+ $ this ->assertSame ($ listenerInjected , $ this ->container ->has ('web_profiler.debug_toolbar ' ));
120
+
121
+ self ::assertSaneContainer ($ this ->getCompiledContainer (), '' , ['web_profiler.csp.handler ' ]);
122
+
123
+ if ($ listenerInjected ) {
124
+ $ this ->assertSame ($ listenerEnabled , $ this ->container ->get ('web_profiler.debug_toolbar ' )->isEnabled ());
125
+ }
126
+ }
127
+
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
+
102
144
/**
103
145
* @group legacy
104
146
*
105
- * @dataProvider getDebugModes
147
+ * @dataProvider getInterceptRedirectsToolbarConfig
106
148
*/
107
- public function testToolbarConfig ($ toolbarEnabled , $ interceptRedirects , $ listenerInjected , $ listenerEnabled )
108
- {
149
+ public function testToolbarConfigUsingInterceptRedirects (
150
+ bool $ toolbarEnabled ,
151
+ bool $ interceptRedirects ,
152
+ bool $ listenerInjected ,
153
+ bool $ listenerEnabled
154
+ ) {
109
155
$ extension = new WebProfilerExtension ();
110
- $ extension ->load ([['toolbar ' => $ toolbarEnabled , 'intercept_redirects ' => $ interceptRedirects ]], $ this ->container );
156
+ $ extension ->load (
157
+ [['toolbar ' => $ toolbarEnabled , 'intercept_redirects ' => $ interceptRedirects ]],
158
+ $ this ->container
159
+ );
111
160
$ this ->container ->removeDefinition ('web_profiler.controller.exception ' );
112
161
113
162
$ this ->assertSame ($ listenerInjected , $ this ->container ->has ('web_profiler.debug_toolbar ' ));
@@ -119,13 +168,27 @@ public function testToolbarConfig($toolbarEnabled, $interceptRedirects, $listene
119
168
}
120
169
}
121
170
122
- public function getDebugModes ()
171
+ public function getInterceptRedirectsToolbarConfig ()
123
172
{
124
173
return [
125
- [false , false , false , false ],
126
- [true , false , true , true ],
127
- [false , true , true , false ],
128
- [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
+ ],
129
192
];
130
193
}
131
194
0 commit comments