@@ -68,6 +68,22 @@ protected function addWebRoutes(Router $router)
68
68
}
69
69
]);
70
70
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
+
71
87
$ router ->get ('web/query/{num?} ' , [
72
88
'uses ' => function ($ num = 1 ) {
73
89
debugbar ()->boot ();
@@ -85,7 +101,6 @@ protected function addWebRoutes(Router $router)
85
101
$ executedQuery = new QueryExecuted ('SELECT * FROM users WHERE username = ? ' , ['debuguser ' . $ i ], 0 , $ connection );
86
102
event ($ executedQuery );
87
103
}
88
-
89
104
return 'PONG ' ;
90
105
}
91
106
]);
@@ -201,6 +216,32 @@ public function testDatabaseCollectsQueries()
201
216
});
202
217
}
203
218
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
+ }
204
245
205
246
public function testDatabaseCollectsQueriesWithSoftLimit ()
206
247
{
0 commit comments