Travis setup and minor cleanup
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php
index e164980..9f89d1b 100644
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -6,9 +6,6 @@
 
 $dir = realpath(dirname(__FILE__));
 
-// Environment constants
-define('ENVIRONMENT', 'testing');
-
 // Path constants
 define('PROJECT_BASE',	realpath($dir.'/../').'/');
 define('BASEPATH',		PROJECT_BASE.'system/');
diff --git a/tests/codeigniter/database/DB_test.php b/tests/codeigniter/database/DB_test.php
index c1930f5..10e8dec 100644
--- a/tests/codeigniter/database/DB_test.php
+++ b/tests/codeigniter/database/DB_test.php
@@ -2,11 +2,31 @@
 
 class DB_test extends CI_TestCase {
 
-	public $db_config;
+	// ------------------------------------------------------------------------
 
-	public function set_up()
+	public function test_db_invalid()
 	{
-		$this->db_config = new Mock_Database_DB(array(
+		$db_config = new Mock_Database_DB(array(
+			'undefined' => array(
+				'dsn' => '',
+				'hostname' => 'undefined',
+				'username' => 'undefined',
+				'password' => 'undefined',
+				'database' => 'undefined',
+				'dbdriver' => 'undefined',
+			),
+		));
+
+		$this->setExpectedException('InvalidArgumentException', 'CI Error: Invalid DB driver');
+
+		Mock_Database_DB::DB($db_config->set_dsn('undefined'), TRUE);
+	}
+
+	// ------------------------------------------------------------------------
+
+	public function test_db_valid()
+	{
+		$db_config = new Mock_Database_DB(array(
 			'mysql' => array(
 				'dsn' => '',
 				'hostname' => 'localhost',
@@ -14,30 +34,13 @@
 				'password' => '',
 				'database' => 'ci_test',
 				'dbdriver' => 'mysql',
-				'dbprefix' => '',
-				'pconnect' => FALSE,
-				'db_debug' => TRUE,
-				'cache_on' => FALSE,
-				'cachedir' => '',
-				'char_set' => 'utf8',
-				'dbcollat' => 'utf8_general_ci',
-				'swap_pre' => '',
-				'autoinit' => TRUE,
-				'stricton' => FALSE,
-				'failover' => array(),
 			),
 		));
-	}
 
-	// ------------------------------------------------------------------------
-
-	public function test_db_valid()
-	{
-		$db = DB($this->db_config->set_config('mysql'), TRUE);
+		$db = Mock_Database_DB::DB($db_config->set_dsn('mysql'), TRUE);
 
 		$this->assertTrue($db instanceof CI_DB);
 		$this->assertTrue($db instanceof CI_DB_Driver);
-		$this->assertTrue($db instanceof CI_DB_active_record);
 		$this->assertTrue($db instanceof CI_DB_mysql_driver);
 	}
 	
diff --git a/tests/codeigniter/database/query_builder/.gitkeep b/tests/codeigniter/database/query_builder/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/.gitkeep
diff --git a/tests/mocks/database/db.php b/tests/mocks/database/db.php
index d7a6351..11e4a93 100644
--- a/tests/mocks/database/db.php
+++ b/tests/mocks/database/db.php
@@ -12,32 +12,61 @@
 	 */
 	public function __construct($config = array())
 	{
-		include_once(BASEPATH.'database/DB.php');
-
 		$this->config = $config;
 	}
 
-	public function set_config($group = 'default')
+	public function set_dsn($group = 'default')
 	{
 		if ( ! isset($this->config[$group]))
 		{
 			throw new InvalidArgumentException('Group '.$group.' not exists');
 		}
 
-		if ( ! empty($this->config[$group]['dsn']))
+		$params = array(
+			'dbprefix' => '',
+			'pconnect' => FALSE,
+			'db_debug' => TRUE,
+			'cache_on' => FALSE,
+			'cachedir' => '',
+			'char_set' => 'utf8',
+			'dbcollat' => 'utf8_general_ci',
+			'swap_pre' => '',
+			'autoinit' => TRUE,
+			'stricton' => FALSE,
+			'failover' => array()
+		);
+
+		$config = array_merge($this->config[$group], $params);
+
+		if ( ! empty($config['dsn']))
 		{
-			$dsn = $this->config[$group]['dsn'];
+			$dsn = $config['dsn'];
 		}
 		else
 		{
-			$config = $this->config[$group];
 			$dsn = $config['dbdriver'].'://'.$config['username'].':'.$config['password']
 			       .'@'.$config['hostname'].'/'.$config['database'];
 
 		}
 
-		$params = array_slice($this->config[$group], 6);
+		$other_params = array_slice($config, 6);
 
-		return $dsn.http_build_query($params);
+		return $dsn.http_build_query($other_params);
+	}
+
+	public static function DB($group, $query_builder = FALSE)
+	{
+		include_once(BASEPATH.'database/DB.php');
+
+		try 
+		{
+			$db = DB($group, $query_builder);
+		}
+		catch (Exception $e)
+		{
+			throw new InvalidArgumentException($e->getMessage());
+		}
+
+		return $db;
 	}
 }
\ No newline at end of file
diff --git a/tests/mocks/database/models/.gitkeep b/tests/mocks/database/models/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/mocks/database/models/.gitkeep