File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -294,6 +294,12 @@ public function getDriverName()
294294 return 'mongodb ' ;
295295 }
296296
297+ /** @inheritdoc */
298+ public function getDriverTitle ()
299+ {
300+ return 'MongoDB ' ;
301+ }
302+
297303 /** @inheritdoc */
298304 protected function getDefaultPostProcessor ()
299305 {
@@ -320,6 +326,14 @@ public function setDatabase(Database $db)
320326 $ this ->db = $ db ;
321327 }
322328
329+ /** @inheritdoc */
330+ public function threadCount ()
331+ {
332+ $ status = $ this ->db ->command (['serverStatus ' => 1 ])->toArray ();
333+
334+ return $ status [0 ]['connections ' ]['current ' ];
335+ }
336+
323337 /**
324338 * Dynamically pass methods to the connection.
325339 *
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ public function testConnection()
2525 {
2626 $ connection = DB ::connection ('mongodb ' );
2727 $ this ->assertInstanceOf (Connection::class, $ connection );
28+
29+ $ this ->assertSame ('mongodb ' , $ connection ->getDriverName ());
30+ $ this ->assertSame ('MongoDB ' , $ connection ->getDriverTitle ());
2831 }
2932
3033 public function testReconnect ()
@@ -305,4 +308,12 @@ public function testServerVersion()
305308 $ version = DB ::connection ('mongodb ' )->getServerVersion ();
306309 $ this ->assertIsString ($ version );
307310 }
311+
312+ public function testThreadsCount ()
313+ {
314+ $ threads = DB ::connection ('mongodb ' )->threadCount ();
315+
316+ $ this ->assertIsInt ($ threads );
317+ $ this ->assertGreaterThanOrEqual (1 , $ threads );
318+ }
308319}
You can’t perform that action at this time.
0 commit comments