/** * Get if mysqltcs is connected (using mysqli::ping) * @return bool if true mysqltcs is connected */ public function isConnected() { return $this->mysqlRef->getMysqli()->ping(); }
public function testConnect() { $db = (require __DIR__ . "/config.php"); $connection = new MysqlConnection($db['host'], $db['user'], $db['psw'], $db['db']); $connection->connect(); $connection2 = new MysqlConnection($db['host'], $db['user'], $db['psw'], $db['db']); $this->assertNotEquals($connection->getMysqli(), null); $this->assertEquals($connection2->getMysqli(), null); $connection2->connect(); $this->assertNotEquals($connection->getMysqli()->thread_id, $connection2->getMysqli()->thread_id); }