Preliminary Database Test
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php
index 9f89d1b..e164980 100644
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -6,6 +6,9 @@
 
 $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/.gitkeep b/tests/codeigniter/database/.gitkeep
deleted file mode 100644
index e69de29..0000000
--- a/tests/codeigniter/database/.gitkeep
+++ /dev/null
diff --git a/tests/codeigniter/database/DB_test.php b/tests/codeigniter/database/DB_test.php
new file mode 100644
index 0000000..c1930f5
--- /dev/null
+++ b/tests/codeigniter/database/DB_test.php
@@ -0,0 +1,44 @@
+<?php
+
+class DB_test extends CI_TestCase {
+
+	public $db_config;
+
+	public function set_up()
+	{
+		$this->db_config = new Mock_Database_DB(array(
+			'mysql' => array(
+				'dsn' => '',
+				'hostname' => 'localhost',
+				'username' => 'travis',
+				'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);
+
+		$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);
+	}
+	
+}
\ No newline at end of file
diff --git a/tests/mocks/database/.gitkeep b/tests/mocks/database/.gitkeep
deleted file mode 100644
index e69de29..0000000
--- a/tests/mocks/database/.gitkeep
+++ /dev/null
diff --git a/tests/mocks/database/db.php b/tests/mocks/database/db.php
new file mode 100644
index 0000000..d7a6351
--- /dev/null
+++ b/tests/mocks/database/db.php
@@ -0,0 +1,43 @@
+<?php
+
+class Mock_Database_DB {
+
+	private $config = array();
+	
+	/**
+	 * Prepare database configuration skeleton
+	 *
+	 * @param  array 	DB configuration to set
+	 * @return void
+	 */
+	public function __construct($config = array())
+	{
+		include_once(BASEPATH.'database/DB.php');
+
+		$this->config = $config;
+	}
+
+	public function set_config($group = 'default')
+	{
+		if ( ! isset($this->config[$group]))
+		{
+			throw new InvalidArgumentException('Group '.$group.' not exists');
+		}
+
+		if ( ! empty($this->config[$group]['dsn']))
+		{
+			$dsn = $this->config[$group]['dsn'];
+		}
+		else
+		{
+			$config = $this->config[$group];
+			$dsn = $config['dbdriver'].'://'.$config['username'].':'.$config['password']
+			       .'@'.$config['hostname'].'/'.$config['database'];
+
+		}
+
+		$params = array_slice($this->config[$group], 6);
+
+		return $dsn.http_build_query($params);
+	}
+}
\ No newline at end of file
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index dfeecd1..ffd2a1f 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -15,10 +15,7 @@
 			<directory suffix="test.php">codeigniter/core</directory>
 			<directory suffix="test.php">codeigniter/helpers</directory>
 			<directory suffix="test.php">codeigniter/libraries</directory>
-			<!-- We'll worry about these later ...
-			<directory suffix="test.php">codeigniter/libraries</directory>
-			<directory suffix="test.php">codeigniter/helpers</directory>
-			-->
+			<directory suffix="test.php">codeigniter/database</directory>
 		</testsuite>
 	</testsuites>
 	<filters>