public function testOneRemoveGeneralException()
 {
     $db = (require __DIR__ . "/config.php");
     $mysqlConnections = MysqlConnections::getInstance();
     $obj = new Mysqltcs($db['host'], $db['user'], $db['psw'], $db['db']);
     $mysqlConnections->getConnection($obj, $db['host'], $db['user'], $db['psw'], $db['db']);
     $mysqlConnections->removeClient($obj);
     $this->setExpectedException('\\it\\thecsea\\mysqltcs\\MysqltcsException');
     $mysqlConnections->removeClient($obj);
 }
Example #2
0
 /**
  * Get a connection to mysql
  * @param String $host
  * @param String $user
  * @param String $password
  * @param String $name database name
  * @param bool $newConnection optional, default true. If it is false the class uses an already open connection if it possible
  * @param string $key optional
  * @param string $cert optional
  * @param string $ca optional
  * @throws MysqlConnectionException
  */
 public function __construct($host, $user, $password, $name, $newConnection = true, $key = "", $cert = "", $ca = "")
 {
     $this->instanceNumber = ++self::$instances;
     $this->host = $host;
     $this->user = $user;
     $this->password = $password;
     $this->name = $name;
     $this->newConnection = $newConnection;
     $this->key = $key;
     $this->cert = $cert;
     $this->ca = $ca;
     $this->mysqlConnections = MysqlConnections::getInstance();
     $this->getConnection();
 }