@@ -34,13 +34,14 @@ class ProfilerControllerTest extends WebTestCase
3434{
3535 public function testHomeActionWithProfilerDisabled ()
3636 {
37- $ this ->expectException (NotFoundHttpException::class);
38- $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
39-
4037 $ urlGenerator = $ this ->createMock (UrlGeneratorInterface::class);
4138 $ twig = $ this ->createMock (Environment::class);
4239
4340 $ controller = new ProfilerController ($ urlGenerator , null , $ twig , []);
41+
42+ $ this ->expectException (NotFoundHttpException::class);
43+ $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
44+
4445 $ controller ->homeAction ();
4546 }
4647
@@ -110,13 +111,14 @@ public function testPanelActionWithValidPanelAndToken()
110111
111112 public function testToolbarActionWithProfilerDisabled ()
112113 {
113- $ this ->expectException (NotFoundHttpException::class);
114- $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
115-
116114 $ urlGenerator = $ this ->createMock (UrlGeneratorInterface::class);
117115 $ twig = $ this ->createMock (Environment::class);
118116
119117 $ controller = new ProfilerController ($ urlGenerator , null , $ twig , []);
118+
119+ $ this ->expectException (NotFoundHttpException::class);
120+ $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
121+
120122 $ controller ->toolbarAction (Request::create ('/_wdt/foo-token ' ), null );
121123 }
122124
@@ -202,13 +204,14 @@ public function testReturns404onTokenNotFound($withCsp)
202204
203205 public function testSearchBarActionWithProfilerDisabled ()
204206 {
205- $ this ->expectException (NotFoundHttpException::class);
206- $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
207-
208207 $ urlGenerator = $ this ->createMock (UrlGeneratorInterface::class);
209208 $ twig = $ this ->createMock (Environment::class);
210209
211210 $ controller = new ProfilerController ($ urlGenerator , null , $ twig , []);
211+
212+ $ this ->expectException (NotFoundHttpException::class);
213+ $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
214+
212215 $ controller ->searchBarAction (Request::create ('/_profiler/search_bar ' ));
213216 }
214217
@@ -296,13 +299,14 @@ public function testSearchResultsAction($withCsp)
296299
297300 public function testSearchActionWithProfilerDisabled ()
298301 {
299- $ this ->expectException (NotFoundHttpException::class);
300- $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
301-
302302 $ urlGenerator = $ this ->createMock (UrlGeneratorInterface::class);
303303 $ twig = $ this ->createMock (Environment::class);
304304
305305 $ controller = new ProfilerController ($ urlGenerator , null , $ twig , []);
306+
307+ $ this ->expectException (NotFoundHttpException::class);
308+ $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
309+
306310 $ controller ->searchBarAction (Request::create ('/_profiler/search ' ));
307311 }
308312
@@ -335,13 +339,14 @@ public function testSearchActionWithoutToken()
335339
336340 public function testPhpinfoActionWithProfilerDisabled ()
337341 {
338- $ this ->expectException (NotFoundHttpException::class);
339- $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
340-
341342 $ urlGenerator = $ this ->createMock (UrlGeneratorInterface::class);
342343 $ twig = $ this ->createMock (Environment::class);
343344
344345 $ controller = new ProfilerController ($ urlGenerator , null , $ twig , []);
346+
347+ $ this ->expectException (NotFoundHttpException::class);
348+ $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
349+
345350 $ controller ->phpinfoAction ();
346351 }
347352
@@ -357,26 +362,28 @@ public function testPhpinfoAction()
357362
358363 public function testFontActionWithProfilerDisabled ()
359364 {
360- $ this ->expectException (NotFoundHttpException::class);
361- $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
362-
363365 $ urlGenerator = $ this ->createMock (UrlGeneratorInterface::class);
364366 $ twig = $ this ->createMock (Environment::class);
365367
366368 $ controller = new ProfilerController ($ urlGenerator , null , $ twig , []);
369+
370+ $ this ->expectException (NotFoundHttpException::class);
371+ $ this ->expectExceptionMessage ('The profiler must be enabled. ' );
372+
367373 $ controller ->fontAction ('JetBrainsMono ' );
368374 }
369375
370376 public function testFontActionWithInvalidFontName ()
371377 {
372- $ this ->expectException (NotFoundHttpException::class);
373- $ this ->expectExceptionMessage ('Font file "InvalidFontName.woff2" not found. ' );
374-
375378 $ urlGenerator = $ this ->createMock (UrlGeneratorInterface::class);
376379 $ profiler = $ this ->createMock (Profiler::class);
377380 $ twig = $ this ->createMock (Environment::class);
378381
379382 $ controller = new ProfilerController ($ urlGenerator , $ profiler , $ twig , []);
383+
384+ $ this ->expectException (NotFoundHttpException::class);
385+ $ this ->expectExceptionMessage ('Font file "InvalidFontName.woff2" not found. ' );
386+
380387 $ controller ->fontAction ('InvalidFontName ' );
381388 }
382389
0 commit comments