/**
  * Initialize database connection (same one used by CodeIgniter)
  *
  * @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
  */
 public final function getConnection()
 {
     if ($this->conn === null) {
         if (self::$pdo == null) {
             $dsn = $this->CI->db->dbdriver . ':dbname=' . $this->CI->db->database . ';host=' . $this->CI->db->hostname;
             self::$pdo = new PDO($dsn, $this->CI->db->username, $this->CI->db->password);
         }
         $this->conn = $this->createDefaultDBConnection(self::$pdo, $this->CI->db->database);
     }
     return $this->conn;
 }
Beispiel #2
0
 public function setUp()
 {
     parent::setUp();
     $this->model = new Model($this->db);
 }