Пример #1
0
 /**
  * Get the connection according to newConnection value
  * @throws MysqlConnectionException
  */
 private function getConnection()
 {
     if ($this->newConnection) {
         $this->mysqlRef = new MysqlConnection($this->host, $this->user, $this->password, $this->name, $this->key, $this->cert, $this->ca);
         $this->mysqlRef->connect();
     } else {
         $this->mysqlRef = $this->mysqlConnections->getConnection($this, $this->host, $this->user, $this->password, $this->name, $this->key, $this->cert, $this->ca);
     }
     $this->mysqliRef = $this->mysqlRef->getMysqli();
 }
Пример #2
0
 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);
 }