@@ -277,6 +277,34 @@ public function testQueryLog()
277
277
}
278
278
}
279
279
280
+ public function testQueryLogWithMultipleClients ()
281
+ {
282
+ $ connection = DB ::connection ('mongodb ' );
283
+ $ this ->assertInstanceOf (Connection::class, $ connection );
284
+
285
+ // Create a second connection with the same config as the first
286
+ // Make sure to change the name as it's used as a connection identifier
287
+ $ config = $ connection ->getConfig ();
288
+ $ config ['name ' ] = 'mongodb2 ' ;
289
+ $ secondConnection = new Connection ($ config );
290
+
291
+ $ connection ->enableQueryLog ();
292
+ $ secondConnection ->enableQueryLog ();
293
+
294
+ $ this ->assertCount (0 , $ connection ->getQueryLog ());
295
+ $ this ->assertCount (0 , $ secondConnection ->getQueryLog ());
296
+
297
+ $ connection ->table ('items ' )->get ();
298
+
299
+ $ this ->assertCount (1 , $ connection ->getQueryLog ());
300
+ $ this ->assertCount (0 , $ secondConnection ->getQueryLog ());
301
+
302
+ $ secondConnection ->table ('items ' )->get ();
303
+
304
+ $ this ->assertCount (1 , $ connection ->getQueryLog ());
305
+ $ this ->assertCount (1 , $ secondConnection ->getQueryLog ());
306
+ }
307
+
280
308
public function testDisableQueryLog ()
281
309
{
282
310
// Disabled by default
0 commit comments