Adding core and libraries mock classes
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php
index 62c7d0d..9f89d1b 100644
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -13,6 +13,7 @@
 define('VIEWPATH',		PROJECT_BASE.'');
 
 // Prep our test environment
+require_once 'vfsStream/vfsStream.php';
 include_once $dir.'/mocks/core/common.php';
 include_once $dir.'/mocks/autoloader.php';
 spl_autoload_register('autoload');
diff --git a/tests/codeigniter/core/Common_test.php b/tests/codeigniter/core/Common_test.php
index 29b512d..dded2e8 100644
--- a/tests/codeigniter/core/Common_test.php
+++ b/tests/codeigniter/core/Common_test.php
@@ -1,7 +1,6 @@
 <?php
 
-class Common_test extends CI_TestCase
-{
+class Common_test extends CI_TestCase {
 	
 	// ------------------------------------------------------------------------
 	
diff --git a/tests/codeigniter/database/.gitkeep b/tests/codeigniter/database/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/codeigniter/database/.gitkeep
diff --git a/tests/codeigniter/libraries/Parser_test.php b/tests/codeigniter/libraries/Parser_test.php
index b4580a4..c3d88fa 100644
--- a/tests/codeigniter/libraries/Parser_test.php
+++ b/tests/codeigniter/libraries/Parser_test.php
@@ -1,14 +1,11 @@
 <?php
 
-require BASEPATH.'libraries/Parser.php';
-
-class Parser_test extends CI_TestCase
-{
+class Parser_test extends CI_TestCase {
 	
 	public function set_up()
 	{
 		$obj = new StdClass;
-		$obj->parser = new CI_Parser();
+		$obj->parser = new Mock_Libraries_Parser();
 		
 		$this->ci_instance($obj);
 		
diff --git a/tests/codeigniter/libraries/Table_test.php b/tests/codeigniter/libraries/Table_test.php
index 0208a46..7d0e408 100644
--- a/tests/codeigniter/libraries/Table_test.php
+++ b/tests/codeigniter/libraries/Table_test.php
@@ -1,14 +1,11 @@
 <?php
 
-require BASEPATH.'libraries/Table.php';
-
-class Table_test extends CI_TestCase
-{
+class Table_test extends CI_TestCase {
 
 	public function set_up()
 	{
 		$obj = new StdClass;
-		$obj->table = new CI_table();
+		$obj->table = new Mock_Libraries_Table();
 		
 		$this->ci_instance($obj);
 		
diff --git a/tests/codeigniter/libraries/Typography_test.php b/tests/codeigniter/libraries/Typography_test.php
index a0533ba..250aefb 100644
--- a/tests/codeigniter/libraries/Typography_test.php
+++ b/tests/codeigniter/libraries/Typography_test.php
@@ -1,14 +1,11 @@
 <?php
 
-require BASEPATH.'libraries/Typography.php';
-
-class Typography_test extends CI_TestCase
-{
+class Typography_test extends CI_TestCase {
 
 	public function set_up()
 	{
 		$obj = new StdClass;
-		$obj->type = new CI_Typography();
+		$obj->type = new Mock_Libraries_Typography();
 		
 		$this->ci_instance($obj);
 		
diff --git a/tests/codeigniter/libraries/User_agent_test.php b/tests/codeigniter/libraries/Useragent_test.php
similarity index 93%
rename from tests/codeigniter/libraries/User_agent_test.php
rename to tests/codeigniter/libraries/Useragent_test.php
index 6f9e871..7dad7ac 100644
--- a/tests/codeigniter/libraries/User_agent_test.php
+++ b/tests/codeigniter/libraries/Useragent_test.php
@@ -1,11 +1,7 @@
 <?php
 
-require BASEPATH.'libraries/User_agent.php';
-
-// This class needs some work...
-
-class UserAgent_test extends CI_TestCase
-{
+class UserAgent_test extends CI_TestCase {
+	
 	protected $_user_agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27';
 	protected $_mobile_ua = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7';
 
@@ -15,7 +11,7 @@
 		$_SERVER['HTTP_USER_AGENT'] = $this->_user_agent;
 
 		$obj = new StdClass;
-		$obj->agent = new CI_User_agent();
+		$obj->agent = new Mock_Libraries_UserAgent();
 
 		$this->ci_instance($obj);
 
diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php
index 442389f..88070e5 100644
--- a/tests/mocks/autoloader.php
+++ b/tests/mocks/autoloader.php
@@ -6,25 +6,73 @@
 //
 // Prototype :
 //
-// include_once('Mock_Core_Common') 						// Will load ./mocks/core/common.php
-// $mock_loader = new Mock_Core_Loader(); 					// Will load ./mocks/core/loader.php
-// $mock_database_driver = new Mock_Database_Driver();		// Will load ./mocks/database/driver.php 
+// include_once('Mock_Core_Common') 					// Will load ./mocks/core/common.php
+// $mock_loader = new Mock_Core_Loader(); 				// Will load ./mocks/core/loader.php
+// $mock_table = new Mock_Libraries_Table(); 			// Will load ./mocks/libraries/table.php
+// $mock_database_driver = new Mock_Database_Driver();	// Will load ./mocks/database/driver.php 
+// and so on...
 function autoload($class) 
 {
-	$class = (strpos($class, 'Mock_') === 0) ? str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class) : $class;
 	$dir = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR;
-	$file = $dir.strtolower($class).'.php';
+
+	$ci_core = array(
+		'Benchmark', 'Config', 'Controller',
+		'Exceptions', 'Hooks', 'Input',
+		'Lang', 'Loader', 'Model',
+		'Output', 'Router', 'Security',
+		'URI', 'Utf8',
+	);
+
+	$ci_libraries = array(
+		'Calendar', 'Cart', 'Driver',
+		'Email', 'Encrypt', 'Form_validation',
+		'Ftp', 'Image_lib', 'Javascript',
+		'Log', 'Migration', 'Pagination',
+		'Parser', 'Profiler', 'Session',
+		'Table', 'Trackback', 'Typography',
+		'Unit_test', 'Upload', 'User_agent',
+		'Xmlrpc', 'Zip',
+	);
+
+	if (strpos($class, 'Mock_') === 0)
+	{
+		$class = str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class);
+		$class = strtolower($class);
+	}
+	elseif (strpos($class, 'CI_') === 0)
+	{
+		$fragments = explode('_', $class, 2);
+		$subclass = next($fragments);
+
+		if (in_array($subclass, $ci_core))
+		{
+			$dir = BASEPATH.'core'.DIRECTORY_SEPARATOR;
+			$class = $subclass;
+		}
+		elseif (in_array($subclass, $ci_libraries))
+		{
+			$dir = BASEPATH.'libraries'.DIRECTORY_SEPARATOR;
+			$class = $subclass;
+		}
+		else
+		{
+			$class = strtolower($class);
+		}
+	}
+
+	$file = $dir.$class.'.php';
 
 	if ( ! file_exists($file))
 	{
 		$trace = debug_backtrace();
 
-		// If the autoload call came from `class_exists`, we skipped
-		// and return FALSE
-		if ($trace[2]['function'] == 'class_exists')
+		// If the autoload call came from `class_exists` or `file_exists`, 
+		// we skipped and return FALSE
+		if ($trace[2]['function'] == 'class_exists' OR $trace[2]['function'] == 'file_exists')
 		{
 			return FALSE;
 		}
+		var_dump($file);die;
 
 	    throw new InvalidArgumentException("Unable to load $class.");
 	}
diff --git a/tests/mocks/core/loader.php b/tests/mocks/core/loader.php
index 115ccc3..d4b29bb 100644
--- a/tests/mocks/core/loader.php
+++ b/tests/mocks/core/loader.php
@@ -1,8 +1,5 @@
 <?php
 
-require_once 'vfsStream/vfsStream.php';
-require_once BASEPATH.'/core/Loader.php';
-
 class Mock_Core_Loader extends CI_Loader {
 	
 	/**
diff --git a/tests/mocks/core/uri.php b/tests/mocks/core/uri.php
index 207c7dc..b694609 100644
--- a/tests/mocks/core/uri.php
+++ b/tests/mocks/core/uri.php
@@ -1,7 +1,5 @@
 <?php
 
-require BASEPATH.'core/URI.php';
-
 class Mock_Core_URI extends CI_URI {
 	
 	public function __construct()
diff --git a/tests/mocks/database/.gitkeep b/tests/mocks/database/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/mocks/database/.gitkeep
diff --git a/tests/mocks/libraries/parser.php b/tests/mocks/libraries/parser.php
new file mode 100644
index 0000000..81dcfb3
--- /dev/null
+++ b/tests/mocks/libraries/parser.php
@@ -0,0 +1,3 @@
+<?php
+
+class Mock_Libraries_Parser extends CI_Parser {}
\ No newline at end of file
diff --git a/tests/mocks/libraries/table.php b/tests/mocks/libraries/table.php
new file mode 100644
index 0000000..a1e998b
--- /dev/null
+++ b/tests/mocks/libraries/table.php
@@ -0,0 +1,3 @@
+<?php
+
+class Mock_Libraries_Table extends CI_Table {}
\ No newline at end of file
diff --git a/tests/mocks/libraries/typography.php b/tests/mocks/libraries/typography.php
new file mode 100644
index 0000000..0f76c57
--- /dev/null
+++ b/tests/mocks/libraries/typography.php
@@ -0,0 +1,3 @@
+<?php
+
+class Mock_Libraries_Typography extends CI_Typography {}
\ No newline at end of file
diff --git a/tests/mocks/libraries/useragent.php b/tests/mocks/libraries/useragent.php
new file mode 100644
index 0000000..c957cde
--- /dev/null
+++ b/tests/mocks/libraries/useragent.php
@@ -0,0 +1,3 @@
+<?php
+
+class Mock_Libraries_UserAgent extends CI_User_agent {}
\ No newline at end of file