@@ -28,6 +28,7 @@ protected function getEnvironmentSetUp($app)
2828
2929 $ this ->addWebRoutes ($ router );
3030 $ this ->addApiRoutes ($ router );
31+ $ this ->addViewPaths ();
3132
3233 $ kernel = app (\Illuminate \Contracts \Http \Kernel::class);
3334 $ kernel ->pushMiddleware (\Illuminate \Session \Middleware \StartSession::class);
@@ -58,6 +59,12 @@ protected function addWebRoutes(Router $router)
5859 return '<html><head></head><body>HTMLPONG</body></html> ' ;
5960 }
6061 ]);
62+
63+ $ router ->get ('web/ajax ' , [
64+ 'uses ' => function () {
65+ return view ('ajax ' );
66+ }
67+ ]);
6168 }
6269
6370 /**
@@ -72,6 +79,11 @@ protected function addApiRoutes(Router $router)
7279 ]);
7380 }
7481
82+ protected function addViewPaths ()
83+ {
84+ config (['view.paths ' => array_merge (config ('view.paths ' ), [__DIR__ . '/resources/views ' ])]);
85+ }
86+
7587 public function testItStacksOnRedirect ()
7688 {
7789 $ this ->browse (function (Browser $ browser ) {
@@ -114,4 +126,16 @@ public function testItDoesntInjectOnJson()
114126 ->assertDontSee ('GET api/ping ' );
115127 });
116128 }
129+
130+ public function testItCapturesAjaxRequests ()
131+ {
132+ $ this ->browse (function (Browser $ browser ) {
133+ $ browser ->visit ('web/ajax ' )
134+ ->waitFor ('.phpdebugbar ' )
135+ ->assertSee ('GET web/ajax ' )
136+ ->click ('#ajax-link ' )
137+ ->waitForTextIn ('#result ' , 'pong ' )
138+ ->assertSee ('GET api/ping ' );
139+ });
140+ }
117141}
0 commit comments