@@ -28,6 +28,7 @@ protected function getEnvironmentSetUp($app)
28
28
29
29
$ this ->addWebRoutes ($ router );
30
30
$ this ->addApiRoutes ($ router );
31
+ $ this ->addViewPaths ();
31
32
32
33
$ kernel = app (\Illuminate \Contracts \Http \Kernel::class);
33
34
$ kernel ->pushMiddleware (\Illuminate \Session \Middleware \StartSession::class);
@@ -58,6 +59,12 @@ protected function addWebRoutes(Router $router)
58
59
return '<html><head></head><body>HTMLPONG</body></html> ' ;
59
60
}
60
61
]);
62
+
63
+ $ router ->get ('web/ajax ' , [
64
+ 'uses ' => function () {
65
+ return view ('ajax ' );
66
+ }
67
+ ]);
61
68
}
62
69
63
70
/**
@@ -72,6 +79,11 @@ protected function addApiRoutes(Router $router)
72
79
]);
73
80
}
74
81
82
+ protected function addViewPaths ()
83
+ {
84
+ config (['view.paths ' => array_merge (config ('view.paths ' ), [__DIR__ . '/resources/views ' ])]);
85
+ }
86
+
75
87
public function testItStacksOnRedirect ()
76
88
{
77
89
$ this ->browse (function (Browser $ browser ) {
@@ -114,4 +126,16 @@ public function testItDoesntInjectOnJson()
114
126
->assertDontSee ('GET api/ping ' );
115
127
});
116
128
}
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
+ }
117
141
}
0 commit comments