@@ -68,6 +68,22 @@ protected function addWebRoutes(Router $router)
6868 }
6969 ]);
7070
71+ $ router ->get ('web/custom-prototype ' , [
72+ 'uses ' => function () {
73+
74+ /** @var Connection $connection */
75+ $ connection = $ this ->app ['db ' ]->connectUsing (
76+ 'runtime-connection ' ,
77+ [
78+ 'driver ' => 'sqlite ' ,
79+ 'database ' => ':memory: ' ,
80+ ],
81+ );
82+ event (new QueryExecuted ('SELECT * FROM users WHERE username = ? ' , ['debuguser ' ], 0 , $ connection ));
83+ return view ('custom-prototype ' );
84+ }
85+ ]);
86+
7187 $ router ->get ('web/query/{num?} ' , [
7288 'uses ' => function ($ num = 1 ) {
7389 debugbar ()->boot ();
@@ -85,7 +101,6 @@ protected function addWebRoutes(Router $router)
85101 $ executedQuery = new QueryExecuted ('SELECT * FROM users WHERE username = ? ' , ['debuguser ' . $ i ], 0 , $ connection );
86102 event ($ executedQuery );
87103 }
88-
89104 return 'PONG ' ;
90105 }
91106 ]);
@@ -201,6 +216,32 @@ public function testDatabaseCollectsQueries()
201216 });
202217 }
203218
219+ public function testDatabaseCollectsQueriesWithCustomPrototype ()
220+ {
221+ if (version_compare ($ this ->app ->version (), '10 ' , '< ' )) {
222+ $ this ->markTestSkipped ('This test is not compatible with Laravel 9.x and below ' );
223+ }
224+
225+ $ this ->browse (function (Browser $ browser ) {
226+ $ browser ->visit ('web/custom-prototype ' )
227+ ->waitFor ('.phpdebugbar ' )
228+ ->click ('.phpdebugbar-tab-history ' )
229+ ->waitForTextIn ('.phpdebugbar-tab[data-collector="queries"] .phpdebugbar-badge ' , 1 )
230+ ->click ('.phpdebugbar-tab[data-collector="queries"] ' )
231+ ->screenshotElement ('.phpdebugbar ' , 'queries-tab ' )
232+ ->waitForText ('executed ' )
233+ ->assertSee ('1 statement was executed ' )
234+ ->with ('.phpdebugbar-widgets-sqlqueries ' , function ($ queriesPane ) {
235+ $ queriesPane ->assertSee ('SELECT * FROM users ' )
236+ ->click ('.phpdebugbar-widgets-expandable:nth-child(2) ' )
237+ ->assertSee ('Bindings ' )
238+ ->assertSee ('debuguser ' )
239+ ->assertSee ('Backtrace ' )
240+ ->assertSee ('LaravelDebugbar.php: ' );
241+ })
242+ ->screenshotElement ('.phpdebugbar ' , 'queries-expanded ' );
243+ });
244+ }
204245
205246 public function testDatabaseCollectsQueriesWithSoftLimit ()
206247 {
0 commit comments