mysql; $this->db = new MySQL("host={$params->host};port={$params->port};dbname={$params->conn_db}", $params->user, $params->pass); } elseif (($var = getenv('CI'))) { $this->db = new MySQL('host=127.0.0.1;port=3306;dbname=test', 'root'); } } function TestExists() { $this->assertTrue(in_array('mysql', pdo_drivers())); } function TestConnection() { if (empty($this->db)) return; $this->assertIsA($this->db, 'MySQL'); } function TestCreateTable() { if (empty($this->db)) return; //Attempt to create the table $sql = $this->db->sql->create_table('create_test', array( 'id' => 'int(10)', 'key' => 'TEXT', 'val' => 'TEXT', ), array( 'id' => 'PRIMARY KEY' ) ); $this->db->query($sql); //Attempt to create the table $sql = $this->db->sql->create_table('create_join', array( 'id' => 'int(10)', 'key' => 'TEXT', 'val' => 'TEXT', ), array( 'id' => 'PRIMARY KEY' ) ); $this->db->query($sql); //Check $dbs = $this->db->get_tables(); $this->assertTrue(in_array('create_test', $dbs)); } }