Amp\Mysql\Pool::ping PHP Method

ping() public method

public ping ( )
    public function ping()
    {
        return $this->connectionPool->getReadyConnection()->ping();
    }

Usage Example

Example #1
0
 function testVirtualConnection()
 {
     $complete = false;
     (new NativeReactor())->run(function ($reactor) use(&$complete) {
         $db = new Pool("host=" . DB_HOST . ";user="******";pass="******";db=connectiontest", null, $reactor);
         /* Multiple queries one after the other must be hold back and dispatched to new connections */
         for ($i = 0; $i < 5; $i++) {
             $pings[] = $db->ping();
         }
         (yield \Amp\all($pings));
         $complete = true;
     });
     $this->assertEquals(true, $complete, "Database commands did not complete.");
 }