Commits

kenjis committed 67130e6

update CIUnit

Comments (0)

Files changed (8)

application/third_party/CIUnit/bootstrap_phpunit.php

  *  CIUnit Version
  * ------------------------------------------------------
  */
-	define('CIUnit_Version', '0.17');
+	define('CIUnit_Version', '0.18-dev_for_CI2.0.3');
 
 /*
  *---------------------------------------------------------------
 
 //=== and off we go ===
 $CI =& set_controller('CIU_Controller', CIUPATH . 'core/');
-$CI->load->add_package_path(APPPATH.'third_party/CIUnit/');
+$CI->load->add_package_path(CIUPATH);
 
 require_once(CIUPATH . 'libraries/spyc/spyc.php');
 

application/third_party/CIUnit/core/CIU_Loader.php

 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
+/*
+* fooStack, CIUnit for CodeIgniter
+* Copyright (c) 2008-2009 Clemens Gruenberger
+* Released under the MIT license, see:
+* http://www.opensource.org/licenses/mit-license.php
+*/
 
-// Is the request a class extension? If so we load it too
-if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').'Loader.php'))
-{
-	require(CIUPATH.'core/CIU_Loader_MY_Loader.php');
+/*
+* CodeIgniter source modified for fooStack / CIUnit
+*
+* If you use MY_Loader, change the paraent class.
+*/
+
+class CIU_Loader extends CI_Loader {
+
+	/**
+	 * Load class
+	 *
+	 * This function loads the requested class.
+	 *
+	 * @param	string	the item that is being loaded
+	 * @param	mixed	any additional parameters
+	 * @param	string	an optional object name
+	 * @return	void
+	 */
+	protected function _ci_load_class($class, $params = NULL, $object_name = NULL)
+	{
+		// Get the class name, and while we're at it trim any slashes.
+		// The directory path can be included as part of the class name,
+		// but we don't want a leading slash
+		$class = str_replace('.php', '', trim($class, '/'));
+
+		// Was the path included with the class name?
+		// We look for a slash to determine this
+		$subdir = '';
+		if (($last_slash = strrpos($class, '/')) !== FALSE)
+		{
+			// Extract the path
+			$subdir = substr($class, 0, $last_slash + 1);
+
+			// Get the filename from the path
+			$class = substr($class, $last_slash + 1);
+		}
+
+		// We'll test for both lowercase and capitalized versions of the file name
+		foreach (array(ucfirst($class), strtolower($class)) as $class)
+		{
+			$subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.'.php';
+			$ciu_subclass = CIUPATH.'libraries/'.$subdir.config_item('ciu_subclass_prefix').$class.'.php';
+
+			// Is this a class extension request?
+			if (file_exists($ciu_subclass))
+			{
+				$baseclass = BASEPATH.'libraries/'.ucfirst($class).'.php';
+
+				if ( ! file_exists($baseclass))
+				{
+					log_message('error', "Unable to load the requested class: ".$class);
+					show_error("Unable to load the requested class: ".$class);
+				}
+
+				// Safety:  Was the class already loaded by a previous call?
+				if (in_array($ciu_subclass, $this->_ci_loaded_files))
+				{
+					// Before we deem this to be a duplicate request, let's see
+					// if a custom object name is being supplied.  If so, we'll
+					// return a new instance of the object
+					if ( ! is_null($object_name))
+					{
+						$CI =& get_instance();
+						if ( ! isset($CI->$object_name))
+						{
+							return $this->_ci_init_class($class, config_item('ciu_subclass_prefix'), $params, $object_name);
+						}
+					}
+
+					$is_duplicate = TRUE;
+					log_message('debug', $class." class already loaded. Second attempt ignored.");
+					return;
+				}
+
+				include_once($baseclass);
+				
+				if (file_exists($subclass))
+				{
+					include_once($subclass);
+				}
+				
+				include_once($ciu_subclass);
+				$this->_ci_loaded_files[] = $ciu_subclass;
+
+				return $this->_ci_init_class($class, config_item('ciu_subclass_prefix'), $params, $object_name);
+			}
+
+			// Is this a class extension request?
+			if (file_exists($subclass))
+			{
+				$baseclass = BASEPATH.'libraries/'.ucfirst($class).'.php';
+
+				if ( ! file_exists($baseclass))
+				{
+					log_message('error', "Unable to load the requested class: ".$class);
+					show_error("Unable to load the requested class: ".$class);
+				}
+
+				// Safety:  Was the class already loaded by a previous call?
+				if (in_array($subclass, $this->_ci_loaded_files))
+				{
+					// Before we deem this to be a duplicate request, let's see
+					// if a custom object name is being supplied.  If so, we'll
+					// return a new instance of the object
+					if ( ! is_null($object_name))
+					{
+						$CI =& get_instance();
+						if ( ! isset($CI->$object_name))
+						{
+							return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
+						}
+					}
+
+					$is_duplicate = TRUE;
+					log_message('debug', $class." class already loaded. Second attempt ignored.");
+					return;
+				}
+
+				include_once($baseclass);
+				include_once($subclass);
+				$this->_ci_loaded_files[] = $subclass;
+
+				return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
+			}
+
+			// Lets search for the requested library file and load it.
+			$is_duplicate = FALSE;
+			foreach ($this->_ci_library_paths as $path)
+			{
+				$filepath = $path.'libraries/'.$subdir.$class.'.php';
+
+				// Does the file exist?  No?  Bummer...
+				if ( ! file_exists($filepath))
+				{
+					continue;
+				}
+
+				// Safety:  Was the class already loaded by a previous call?
+				if (in_array($filepath, $this->_ci_loaded_files))
+				{
+					// Before we deem this to be a duplicate request, let's see
+					// if a custom object name is being supplied.  If so, we'll
+					// return a new instance of the object
+					if ( ! is_null($object_name))
+					{
+						$CI =& get_instance();
+						if ( ! isset($CI->$object_name))
+						{
+							return $this->_ci_init_class($class, '', $params, $object_name);
+						}
+					}
+
+					$is_duplicate = TRUE;
+					log_message('debug', $class." class already loaded. Second attempt ignored.");
+					return;
+				}
+
+				include_once($filepath);
+				$this->_ci_loaded_files[] = $filepath;
+				return $this->_ci_init_class($class, '', $params, $object_name);
+			}
+
+		} // END FOREACH
+
+		// One last attempt.  Maybe the library is in a subdirectory, but it wasn't specified?
+		if ($subdir == '')
+		{
+			$path = strtolower($class).'/'.$class;
+			return $this->_ci_load_class($path, $params);
+		}
+
+		// If we got this far we were unable to find the requested class.
+		// We do not issue errors if the load call failed due to a duplicate request
+		if ($is_duplicate == FALSE)
+		{
+			log_message('error', "Unable to load the requested class: ".$class);
+			show_error("Unable to load the requested class: ".$class);
+		}
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Instantiates a class
+	 *
+	 * @param	string
+	 * @param	string
+	 * @param	string	an optional object name
+	 * @return	null
+	 */
+	protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL)
+	{
+		// Is there an associated config file for this class? Note: these should always be lowercase
+		if ($config === NULL)
+		{
+			// Fetch the config paths containing any package paths
+			$config_component = $this->_ci_get_component('config');
+
+			if (is_array($config_component->_config_paths))
+			{
+				// Break on the first found file, thus package files
+				// are not overridden by default paths
+				foreach ($config_component->_config_paths as $path)
+				{
+					// We test for both uppercase and lowercase, for servers that
+					// are case-sensitive with regard to file names. Check for environment
+					// first, global next
+					if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
+					{
+						include_once($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
+						break;
+					}
+					elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
+					{
+						include_once($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
+						break;
+					}
+					elseif (file_exists($path .'config/'.strtolower($class).'.php'))
+					{
+						include_once($path .'config/'.strtolower($class).'.php');
+						break;
+					}
+					elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php'))
+					{
+						include_once($path .'config/'.ucfirst(strtolower($class)).'.php');
+						break;
+					}
+				}
+			}
+		}
+
+		if ($prefix == '')
+		{
+			if (class_exists('CI_'.$class))
+			{
+				$name = 'CI_'.$class;
+			}
+			elseif (class_exists(config_item('subclass_prefix').$class))
+			{
+				$name = config_item('subclass_prefix').$class;
+			}
+			else
+			{
+				$name = $class;
+			}
+		}
+		else
+		{
+			$name = $prefix.$class;
+		}
+
+		// Is the class name valid?
+		if ( ! class_exists($name))
+		{
+			log_message('error', "Non-existent class: ".$name);
+			show_error("Non-existent class: ".$class);
+		}
+
+		// Set the variable name we will assign the class to
+		// Was a custom class name supplied? If so we'll use it
+		$class = strtolower($class);
+
+		if (is_null($object_name))
+		{
+			$classvar = ( ! isset($this->_ci_varmap[$class])) ? $class : $this->_ci_varmap[$class];
+		}
+		else
+		{
+			$classvar = $object_name;
+		}
+
+		// Save the class name and object name
+		$this->_ci_classes[$class] = $classvar;
+		// Instantiate the class
+		$CI =& get_instance();
+		if ($config !== NULL)
+		{
+			if ( ! defined('CIUnit_Version'))
+			{
+				$CI->$classvar = new $name($config);
+			}
+			elseif ( ! isset($CI->$classvar))
+			{
+				//redesignme: check if we have got one already..
+				$CI->$classvar = new $name($config);
+			}
+		}
+		else
+		{
+			if ( ! defined('CIUnit_Version'))
+			{
+				$CI->$classvar = new $name;
+			}
+			elseif ( ! isset($CI->$classvar))
+			{
+				//redesignme: check if we have got one already..
+				$CI->$classvar = new $name;
+			}
+		}
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Autoloader
+	 *
+	 * The config/autoload.php file contains an array that permits sub-systems,
+	 * libraries, and helpers to be loaded automatically.
+	 *
+	 * This function is public, as it's used in the CI_Controller class.
+	 * However, there is no reason you should ever needs to use it.
+	 *
+	 * @param	array
+	 * @return	void
+	 */
+	public function ci_autoloader()
+	{
+		if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
+		{
+			// enable multiple autoload during tests
+			include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php');
+		}
+		else
+		{
+			// enable multiple autoload during tests
+			include(APPPATH.'config/autoload.php');
+		}
+
+
+		if ( ! isset($autoload))
+		{
+			return FALSE;
+		}
+
+		// Autoload packages
+		if (isset($autoload['packages']))
+		{
+			foreach ($autoload['packages'] as $package_path)
+			{
+				$this->add_package_path($package_path);
+			}
+		}
+
+		// Load any custom config file
+		if (count($autoload['config']) > 0)
+		{
+			$CI =& get_instance();
+			foreach ($autoload['config'] as $key => $val)
+			{
+				$CI->config->load($val);
+			}
+		}
+
+		// Autoload helpers and languages
+		foreach (array('helper', 'language') as $type)
+		{
+			if (isset($autoload[$type]) AND count($autoload[$type]) > 0)
+			{
+				$this->$type($autoload[$type]);
+			}
+		}
+
+		// A little tweak to remain backward compatible
+		// The $autoload['core'] item was deprecated
+		if ( ! isset($autoload['libraries']) AND isset($autoload['core']))
+		{
+			$autoload['libraries'] = $autoload['core'];
+		}
+
+		// Load libraries
+		if (isset($autoload['libraries']) AND count($autoload['libraries']) > 0)
+		{
+			// Load the database driver.
+			if (in_array('database', $autoload['libraries']))
+			{
+				$this->database();
+				$autoload['libraries'] = array_diff($autoload['libraries'], array('database'));
+			}
+
+			// Load all other libraries
+			foreach ($autoload['libraries'] as $item)
+			{
+				$this->library($item);
+			}
+		}
+
+		// Autoload models
+		if (isset($autoload['model']))
+		{
+			$this->model($autoload['model']);
+		}
+	}
+
+	// --------------------------------------------------------------------
+
+	/*
+	* Can load a view file from an absolute path and
+	* relative to the CodeIgniter index.php file
+	* Handy if you have views outside the usual CI views dir
+	*/
+	function viewfile($viewfile, $vars = array(), $return = FALSE)
+	{
+		return $this->_ci_load(
+			array('_ci_path' => $viewfile,
+				'_ci_vars' => $this->_ci_object_to_array($vars),
+				'_ci_return' => $return)
+		);
+	}
+
+	// --------------------------------------------------------------------
+
+	function reset()
+	{
+		$this->_ci_cached_vars = array();
+		$this->_ci_classes = array();
+		$this->_ci_loaded_files = array();
+		$this->_ci_models = array();
+		$this->_ci_helpers = array();
+	}
 }
-else
-{
-	require(CIUPATH.'core/CIU_Loader_CI_Loader.php');
-}
-/* End of file CIU_Loader.php */
-/* Location: ./application/third_party/CIUnit/core/CIU_Loader.php */
+
+/* End of file CIU_Loader_CI_Loader.php */
+/* Location: ./application/third_party/CIUnit/core/CIU_Loader_CI_Loader.php */

application/third_party/CIUnit/core/CIU_Loader_CI_Loader.php

-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-
-/*
-* fooStack, CIUnit for CodeIgniter
-* Copyright (c) 2008-2009 Clemens Gruenberger
-* Released under the MIT license, see:
-* http://www.opensource.org/licenses/mit-license.php
-*/
-
-/*
-* CodeIgniter source modified for fooStack / CIUnit
-* CIU_Loader_CI_Loader.php and CIU_Loader_MY_Loader.php are the same except parent class. 
-*/
-
-class CIU_Loader extends CI_Loader {
-
-	/**
-	 * Instantiates a class
-	 *
-	 * @param	string
-	 * @param	string
-	 * @param	string	an optional object name
-	 * @return	null
-	 */
-	protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL)
-	{
-		// Is there an associated config file for this class? Note: these should always be lowercase
-		if ($config === NULL)
-		{
-			// Fetch the config paths containing any package paths
-			$config_component = $this->_ci_get_component('config');
-
-			if (is_array($config_component->_config_paths))
-			{
-				// Break on the first found file, thus package files
-				// are not overridden by default paths
-				foreach ($config_component->_config_paths as $path)
-				{
-					// We test for both uppercase and lowercase, for servers that
-					// are case-sensitive with regard to file names. Check for environment
-					// first, global next
-					if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
-					{
-						include_once($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
-						break;
-					}
-					elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
-					{
-						include_once($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
-						break;
-					}
-					elseif (file_exists($path .'config/'.strtolower($class).'.php'))
-					{
-						include_once($path .'config/'.strtolower($class).'.php');
-						break;
-					}
-					elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php'))
-					{
-						include_once($path .'config/'.ucfirst(strtolower($class)).'.php');
-						break;
-					}
-				}
-			}
-		}
-
-		if ($prefix == '')
-		{
-			if (class_exists('CI_'.$class))
-			{
-				$name = 'CI_'.$class;
-			}
-			elseif (class_exists(config_item('subclass_prefix').$class))
-			{
-				$name = config_item('subclass_prefix').$class;
-			}
-			else
-			{
-				$name = $class;
-			}
-		}
-		else
-		{
-			$name = $prefix.$class;
-		}
-
-		// Is the class name valid?
-		if ( ! class_exists($name))
-		{
-			log_message('error', "Non-existent class: ".$name);
-			show_error("Non-existent class: ".$class);
-		}
-
-		// Set the variable name we will assign the class to
-		// Was a custom class name supplied? If so we'll use it
-		$class = strtolower($class);
-
-		if (is_null($object_name))
-		{
-			$classvar = ( ! isset($this->_ci_varmap[$class])) ? $class : $this->_ci_varmap[$class];
-		}
-		else
-		{
-			$classvar = $object_name;
-		}
-
-		// Save the class name and object name
-		$this->_ci_classes[$class] = $classvar;
-		// Instantiate the class
-		$CI =& get_instance();
-		if ($config !== NULL)
-		{
-			if ( ! defined('CIUnit_Version'))
-			{
-				$CI->$classvar = new $name($config);
-			}
-			elseif ( ! isset($CI->$classvar))
-			{
-				//redesignme: check if we have got one already..
-				$CI->$classvar = new $name($config);
-			}
-		}
-		else
-		{
-			if ( ! defined('CIUnit_Version'))
-			{
-				$CI->$classvar = new $name;
-			}
-			elseif ( ! isset($CI->$classvar))
-			{
-				//redesignme: check if we have got one already..
-				$CI->$classvar = new $name;
-			}
-		}
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Autoloader
-	 *
-	 * The config/autoload.php file contains an array that permits sub-systems,
-	 * libraries, and helpers to be loaded automatically.
-	 *
-	 * This function is public, as it's used in the CI_Controller class.
-	 * However, there is no reason you should ever needs to use it.
-	 *
-	 * @param	array
-	 * @return	void
-	 */
-	public function ci_autoloader()
-	{
-		if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
-		{
-			// enable multiple autoload during tests
-			include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php');
-		}
-		else
-		{
-			// enable multiple autoload during tests
-			include(APPPATH.'config/autoload.php');
-		}
-
-
-		if ( ! isset($autoload))
-		{
-			return FALSE;
-		}
-
-		// Autoload packages
-		if (isset($autoload['packages']))
-		{
-			foreach ($autoload['packages'] as $package_path)
-			{
-				$this->add_package_path($package_path);
-			}
-		}
-
-		// Load any custom config file
-		if (count($autoload['config']) > 0)
-		{
-			$CI =& get_instance();
-			foreach ($autoload['config'] as $key => $val)
-			{
-				$CI->config->load($val);
-			}
-		}
-
-		// Autoload helpers and languages
-		foreach (array('helper', 'language') as $type)
-		{
-			if (isset($autoload[$type]) AND count($autoload[$type]) > 0)
-			{
-				$this->$type($autoload[$type]);
-			}
-		}
-
-		// A little tweak to remain backward compatible
-		// The $autoload['core'] item was deprecated
-		if ( ! isset($autoload['libraries']) AND isset($autoload['core']))
-		{
-			$autoload['libraries'] = $autoload['core'];
-		}
-
-		// Load libraries
-		if (isset($autoload['libraries']) AND count($autoload['libraries']) > 0)
-		{
-			// Load the database driver.
-			if (in_array('database', $autoload['libraries']))
-			{
-				$this->database();
-				$autoload['libraries'] = array_diff($autoload['libraries'], array('database'));
-			}
-
-			// Load all other libraries
-			foreach ($autoload['libraries'] as $item)
-			{
-				$this->library($item);
-			}
-		}
-
-		// Autoload models
-		if (isset($autoload['model']))
-		{
-			$this->model($autoload['model']);
-		}
-	}
-
-	// --------------------------------------------------------------------
-
-	/*
-	* Can load a view file from an absolute path and
-	* relative to the CodeIgniter index.php file
-	* Handy if you have views outside the usual CI views dir
-	*/
-	function viewfile($viewfile, $vars = array(), $return = FALSE)
-	{
-		return $this->_ci_load(
-			array('_ci_path' => $viewfile,
-				'_ci_vars' => $this->_ci_object_to_array($vars),
-				'_ci_return' => $return)
-		);
-	}
-
-	// --------------------------------------------------------------------
-
-	function reset()
-	{
-		$this->_ci_cached_vars = array();
-		$this->_ci_classes = array();
-		$this->_ci_loaded_files = array();
-		$this->_ci_models = array();
-		$this->_ci_helpers = array();
-	}
-}
-
-/* End of file CIU_Loader_CI_Loader.php */
-/* Location: ./application/third_party/CIUnit/core/CIU_Loader_CI_Loader.php */

application/third_party/CIUnit/core/CIU_Loader_MY_Loader.php

-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-
-/*
-* fooStack, CIUnit for CodeIgniter
-* Copyright (c) 2008-2009 Clemens Gruenberger
-* Released under the MIT license, see:
-* http://www.opensource.org/licenses/mit-license.php
-*/
-
-/*
-* CodeIgniter source modified for fooStack / CIUnit
-* CIU_Loader_CI_Loader.php and CIU_Loader_MY_Loader.php are the same except parent class. 
-*/
-
-class CIU_Loader extends MY_Loader {
-
-	/**
-	 * Instantiates a class
-	 *
-	 * @param	string
-	 * @param	string
-	 * @param	string	an optional object name
-	 * @return	null
-	 */
-	protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL)
-	{
-		// Is there an associated config file for this class? Note: these should always be lowercase
-		if ($config === NULL)
-		{
-			// Fetch the config paths containing any package paths
-			$config_component = $this->_ci_get_component('config');
-
-			if (is_array($config_component->_config_paths))
-			{
-				// Break on the first found file, thus package files
-				// are not overridden by default paths
-				foreach ($config_component->_config_paths as $path)
-				{
-					// We test for both uppercase and lowercase, for servers that
-					// are case-sensitive with regard to file names. Check for environment
-					// first, global next
-					if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
-					{
-						include_once($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
-						break;
-					}
-					elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
-					{
-						include_once($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
-						break;
-					}
-					elseif (file_exists($path .'config/'.strtolower($class).'.php'))
-					{
-						include_once($path .'config/'.strtolower($class).'.php');
-						break;
-					}
-					elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php'))
-					{
-						include_once($path .'config/'.ucfirst(strtolower($class)).'.php');
-						break;
-					}
-				}
-			}
-		}
-
-		if ($prefix == '')
-		{
-			if (class_exists('CI_'.$class))
-			{
-				$name = 'CI_'.$class;
-			}
-			elseif (class_exists(config_item('subclass_prefix').$class))
-			{
-				$name = config_item('subclass_prefix').$class;
-			}
-			else
-			{
-				$name = $class;
-			}
-		}
-		else
-		{
-			$name = $prefix.$class;
-		}
-
-		// Is the class name valid?
-		if ( ! class_exists($name))
-		{
-			log_message('error', "Non-existent class: ".$name);
-			show_error("Non-existent class: ".$class);
-		}
-
-		// Set the variable name we will assign the class to
-		// Was a custom class name supplied? If so we'll use it
-		$class = strtolower($class);
-
-		if (is_null($object_name))
-		{
-			$classvar = ( ! isset($this->_ci_varmap[$class])) ? $class : $this->_ci_varmap[$class];
-		}
-		else
-		{
-			$classvar = $object_name;
-		}
-
-		// Save the class name and object name
-		$this->_ci_classes[$class] = $classvar;
-		// Instantiate the class
-		$CI =& get_instance();
-		if ($config !== NULL)
-		{
-			if ( ! defined('CIUnit_Version'))
-			{
-				$CI->$classvar = new $name($config);
-			}
-			elseif ( ! isset($CI->$classvar))
-			{
-				//redesignme: check if we have got one already..
-				$CI->$classvar = new $name($config);
-			}
-		}
-		else
-		{
-			if ( ! defined('CIUnit_Version'))
-			{
-				$CI->$classvar = new $name;
-			}
-			elseif ( ! isset($CI->$classvar))
-			{
-				//redesignme: check if we have got one already..
-				$CI->$classvar = new $name;
-			}
-		}
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * Autoloader
-	 *
-	 * The config/autoload.php file contains an array that permits sub-systems,
-	 * libraries, and helpers to be loaded automatically.
-	 *
-	 * This function is public, as it's used in the CI_Controller class.
-	 * However, there is no reason you should ever needs to use it.
-	 *
-	 * @param	array
-	 * @return	void
-	 */
-	public function ci_autoloader()
-	{
-		if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
-		{
-			// enable multiple autoload during tests
-			include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php');
-		}
-		else
-		{
-			// enable multiple autoload during tests
-			include(APPPATH.'config/autoload.php');
-		}
-
-
-		if ( ! isset($autoload))
-		{
-			return FALSE;
-		}
-
-		// Autoload packages
-		if (isset($autoload['packages']))
-		{
-			foreach ($autoload['packages'] as $package_path)
-			{
-				$this->add_package_path($package_path);
-			}
-		}
-
-		// Load any custom config file
-		if (count($autoload['config']) > 0)
-		{
-			$CI =& get_instance();
-			foreach ($autoload['config'] as $key => $val)
-			{
-				$CI->config->load($val);
-			}
-		}
-
-		// Autoload helpers and languages
-		foreach (array('helper', 'language') as $type)
-		{
-			if (isset($autoload[$type]) AND count($autoload[$type]) > 0)
-			{
-				$this->$type($autoload[$type]);
-			}
-		}
-
-		// A little tweak to remain backward compatible
-		// The $autoload['core'] item was deprecated
-		if ( ! isset($autoload['libraries']) AND isset($autoload['core']))
-		{
-			$autoload['libraries'] = $autoload['core'];
-		}
-
-		// Load libraries
-		if (isset($autoload['libraries']) AND count($autoload['libraries']) > 0)
-		{
-			// Load the database driver.
-			if (in_array('database', $autoload['libraries']))
-			{
-				$this->database();
-				$autoload['libraries'] = array_diff($autoload['libraries'], array('database'));
-			}
-
-			// Load all other libraries
-			foreach ($autoload['libraries'] as $item)
-			{
-				$this->library($item);
-			}
-		}
-
-		// Autoload models
-		if (isset($autoload['model']))
-		{
-			$this->model($autoload['model']);
-		}
-	}
-
-	// --------------------------------------------------------------------
-
-	/*
-	* Can load a view file from an absolute path and
-	* relative to the CodeIgniter index.php file
-	* Handy if you have views outside the usual CI views dir
-	*/
-	function viewfile($viewfile, $vars = array(), $return = FALSE)
-	{
-		return $this->_ci_load(
-			array('_ci_path' => $viewfile,
-				'_ci_vars' => $this->_ci_object_to_array($vars),
-				'_ci_return' => $return)
-		);
-	}
-
-	// --------------------------------------------------------------------
-
-	function reset()
-	{
-		$this->_ci_cached_vars = array();
-		$this->_ci_classes = array();
-		$this->_ci_loaded_files = array();
-		$this->_ci_models = array();
-		$this->_ci_helpers = array();
-	}
-}
-
-/* End of file CIU_Loader_MY_Loader.php */
-/* Location: ./application/third_party/CIUnit/core/CIU_Loader_MY_Loader.php */

application/third_party/CIUnit/core/CIU_Output.php

 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
+/*
+* fooStack, CIUnit for CodeIgniter
+* Copyright (c) 2008-2009 Clemens Gruenberger
+* Released under the MIT license, see:
+* http://www.opensource.org/licenses/mit-license.php
+*/
 
-// Is the request a class extension? If so we load it too
-if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').'Output.php'))
-{
-	require(CIUPATH.'core/CIU_Output_MY_Output.php');
+/*
+* CodeIgniter source modified for fooStack / CIUnit
+* 
+* If you use MY_Output, change the paraent class.
+*/
+
+class CIU_Output extends CI_Output {
+
+	function __construct()
+	{
+		parent::__construct();
+		$this->final_output = ''; //would be just set to 'null' in CI_Output
+		$this->_ci_ob_level  = ob_get_level();
+		$this->cookies = array();
+	}
+
+	/**
+	* store cookie headers
+	*/
+	function set_cookie($arr)
+	{
+		if ( ! is_array($arr))
+		{
+			$arr = func_get_args();
+		}
+		$this->cookies[] = $arr;
+	}
+
+	/**
+	* Add to instead of replace final output
+	*/
+	function add_output($str)
+	{
+		$this->final_output .= $str;
+	}
+
+	/**
+	* Pop Output
+	*
+	* The final output the output class has stringed together is returned and truncated
+	*
+	*/
+	function pop_output()
+	{
+		$output = $this->final_output;
+		$this->final_output = "";
+		return $output;
+	}
+
+	/**
+	* set_no_cache_headers
+	* called as a post controller construction hook
+	* should count therefore as controller duty
+	*/
+	function set_no_cache_headers()
+	{
+		//somehow $this can't be used as headers are not set in that case
+		$CI =& get_instance();
+		$CI->output->soft_set_header('Content-type: text/html; charset=utf-8');
+		$CI->output->soft_set_header('Cache-Control: no-cache');
+		log_message('debug', 'no cache headers set in output class');
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * sets headers if not already set
+	 */
+	function soft_set_header($header)
+	{
+		$key = strtolower(array_shift(split(':', $header)));
+		$add = true;
+		foreach($this->headers as $hdr)
+		{
+			$h = split(':', $hdr);
+			if(strtolower(array_shift($h)) == $key)
+			{
+				$add = false;
+			}
+		}
+		$add ? ($this->headers[] = $header) : '';
+	}
+
+	/**
+	* say
+	* like normal echo but puts it in the output_buffer first, so we still can set headers
+	* and post process it
+	*/
+	function say($str)
+	{
+		ob_start();
+		echo $str;
+		$this->ob_flush_clean();
+	}
+
+	/**
+	* ob_flush_clean
+	* flushes or cleans the buffer depending on if we are finished outputting or still on a nested level
+	*/
+	function ob_flush_clean()
+	{
+		$CI =& get_instance();
+		if (ob_get_level() > $this->_ci_ob_level + 1)
+		{
+			ob_end_flush();
+		}
+		else
+		{
+			$this->add_output(ob_get_contents());
+			@ob_end_clean();
+		}
+	}
+
+	/**
+	 * Display Output
+	 *
+	 * All "view" data is automatically put into this variable by the controller class:
+	 *
+	 * $this->final_output
+	 *
+	 * This function sends the finalized output data to the browser along
+	 * with any server headers and profile data. It also stops the
+	 * benchmark timer so the page rendering speed and memory usage can be shown.
+	 *
+	 * @access	public
+	 * @return	mixed
+	 */
+	function _display($output = '')
+	{
+		// Note: We use globals because we can't use $CI =& get_instance()
+		// since this function is sometimes called by the caching mechanism,
+		// which happens before the CI super object is available.
+		global $BM, $CFG;
+
+		// Grab the super object if we can.
+		if (class_exists('CI_Controller'))
+		{
+			$CI =& get_instance();
+		}
+
+		// --------------------------------------------------------------------
+
+		// Set the output data
+		if ($output == '')
+		{
+			$output =& $this->final_output;
+		}
+
+		// --------------------------------------------------------------------
+
+		// Do we need to write a cache file? Only if the controller does not have its
+		// own _output() method and we are not dealing with a cache file, which we
+		// can determine by the existence of the $CI object above
+		if ($this->cache_expiration > 0 && isset($CI) && ! method_exists($CI, '_output'))
+		{
+			$this->_write_cache($output);
+		}
+
+		// --------------------------------------------------------------------
+
+		// Parse out the elapsed time and memory usage,
+		// then swap the pseudo-variables with the data
+
+		$elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end');
+
+		if ($this->parse_exec_vars === TRUE)
+		{
+			$memory	 = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB';
+
+			$output = str_replace('{elapsed_time}', $elapsed, $output);
+			$output = str_replace('{memory_usage}', $memory, $output);
+		}
+
+		// --------------------------------------------------------------------
+
+		// Is compression requested?
+		if ($CFG->item('compress_output') === TRUE && $this->_zlib_oc == FALSE)
+		{
+			if (extension_loaded('zlib'))
+			{
+				if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) AND strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE)
+				{
+					ob_start('ob_gzhandler');
+				}
+			}
+		}
+
+		// --------------------------------------------------------------------
+
+		// Are there any server headers to send?
+		if (count($this->headers) > 0)
+		{
+			foreach ($this->headers as $header)
+			{
+				@header($header[0], $header[1]);
+				log_message('debug', "header '$header[0], $header[1]' set.");
+			}
+		}
+
+		// --------------------------------------------------------------------
+
+		// Are there any cookies to set?
+		if (count($this->cookies) > 0)
+		{
+			foreach ($this->cookies as $cookie)
+			{
+				call_user_func_array ( 'setcookie' , $cookie );
+				log_message('debug', "cookie '".join(', ', $cookie)."' set.");
+			}
+		}
+
+
+		// --------------------------------------------------------------------
+
+		// If not we know we are dealing with a cache file so we'll
+		// simply echo out the data and exit.
+		if ( ! isset($CI))
+		{
+			echo $output;
+			log_message('debug', "Final output sent to browser");
+			log_message('debug', "Total execution time: ".$elapsed);
+			return TRUE;
+		}
+
+		// --------------------------------------------------------------------
+
+		// Do we need to generate profile data?
+		// If so, load the Profile class and run it.
+		if ($this->enable_profiler == TRUE)
+		{
+			$CI->load->library('profiler');
+
+			if ( ! empty($this->_profiler_sections))
+			{
+				$CI->profiler->set_sections($this->_profiler_sections);
+			}
+
+			// If the output data contains closing </body> and </html> tags
+			// we will remove them and add them back after we insert the profile data
+			if (preg_match("|</body>.*?</html>|is", $output))
+			{
+				$output = preg_replace("|</body>.*?</html>|is", '', $output);
+				$output .= $CI->profiler->run();
+				$output .= '</body></html>';
+			}
+			else
+			{
+				$output .= $CI->profiler->run();
+			}
+		}
+
+		// --------------------------------------------------------------------
+
+		// Does the controller contain a function named _output()?
+		// If so send the output there. Otherwise, echo it.
+		if (method_exists($CI, '_output'))
+		{
+			$CI->_output($output);
+		}
+		else
+		{
+			echo $output; // Send it to the browser!
+		}
+
+		log_message('debug', "Final output sent to browser");
+		log_message('debug', "Total execution time: ".$elapsed);
+	}
+
+	// --------------------------------------------------------------------
 }
-else
-{
-	require(CIUPATH.'core/CIU_Output_CI_Output.php');
-}
-/* End of file CIU_Output.php */
-/* Location: ./application/third_party/CIUnit/core/CIU_Output.php */
+
+/* End of file CIU_Output_CI_Output.php */
+/* Location: ./application/third_party/CIUnit/core/CIU_Output_CI_Output.php */

application/third_party/CIUnit/core/CIU_Output_CI_Output.php

-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-
-/*
-* fooStack, CIUnit for CodeIgniter
-* Copyright (c) 2008-2009 Clemens Gruenberger
-* Released under the MIT license, see:
-* http://www.opensource.org/licenses/mit-license.php
-*/
-
-/*
-* CodeIgniter source modified for fooStack / CIUnit
-* CIU_Output_CI_Output.php and CIU_Output_MY_Output.php are the same except parent class.
-*/
-
-class CIU_Output extends CI_Output {
-
-	function __construct()
-	{
-		parent::__construct();
-		$this->final_output = ''; //would be just set to 'null' in CI_Output
-		$this->_ci_ob_level  = ob_get_level();
-		$this->cookies = array();
-	}
-
-	/**
-	* store cookie headers
-	*/
-	function set_cookie($arr)
-	{
-		if ( ! is_array($arr))
-		{
-			$arr = func_get_args();
-		}
-		$this->cookies[] = $arr;
-	}
-
-	/**
-	* Add to instead of replace final output
-	*/
-	function add_output($str)
-	{
-		$this->final_output .= $str;
-	}
-
-	/**
-	* Pop Output
-	*
-	* The final output the output class has stringed together is returned and truncated
-	*
-	*/
-	function pop_output()
-	{
-		$output = $this->final_output;
-		$this->final_output = "";
-		return $output;
-	}
-
-	/**
-	* set_no_cache_headers
-	* called as a post controller construction hook
-	* should count therefore as controller duty
-	*/
-	function set_no_cache_headers()
-	{
-		//somehow $this can't be used as headers are not set in that case
-		$CI =& get_instance();
-		$CI->output->soft_set_header('Content-type: text/html; charset=utf-8');
-		$CI->output->soft_set_header('Cache-Control: no-cache');
-		log_message('debug', 'no cache headers set in output class');
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * sets headers if not already set
-	 */
-	function soft_set_header($header)
-	{
-		$key = strtolower(array_shift(split(':', $header)));
-		$add = true;
-		foreach($this->headers as $hdr)
-		{
-			$h = split(':', $hdr);
-			if(strtolower(array_shift($h)) == $key)
-			{
-				$add = false;
-			}
-		}
-		$add ? ($this->headers[] = $header) : '';
-	}
-
-	/**
-	* say
-	* like normal echo but puts it in the output_buffer first, so we still can set headers
-	* and post process it
-	*/
-	function say($str)
-	{
-		ob_start();
-		echo $str;
-		$this->ob_flush_clean();
-	}
-
-	/**
-	* ob_flush_clean
-	* flushes or cleans the buffer depending on if we are finished outputting or still on a nested level
-	*/
-	function ob_flush_clean()
-	{
-		$CI =& get_instance();
-		if (ob_get_level() > $this->_ci_ob_level + 1)
-		{
-			ob_end_flush();
-		}
-		else
-		{
-			$this->add_output(ob_get_contents());
-			@ob_end_clean();
-		}
-	}
-
-	/**
-	 * Display Output
-	 *
-	 * All "view" data is automatically put into this variable by the controller class:
-	 *
-	 * $this->final_output
-	 *
-	 * This function sends the finalized output data to the browser along
-	 * with any server headers and profile data. It also stops the
-	 * benchmark timer so the page rendering speed and memory usage can be shown.
-	 *
-	 * @access	public
-	 * @return	mixed
-	 */
-	function _display($output = '')
-	{
-		// Note: We use globals because we can't use $CI =& get_instance()
-		// since this function is sometimes called by the caching mechanism,
-		// which happens before the CI super object is available.
-		global $BM, $CFG;
-
-		// Grab the super object if we can.
-		if (class_exists('CI_Controller'))
-		{
-			$CI =& get_instance();
-		}
-
-		// --------------------------------------------------------------------
-
-		// Set the output data
-		if ($output == '')
-		{
-			$output =& $this->final_output;
-		}
-
-		// --------------------------------------------------------------------
-
-		// Do we need to write a cache file? Only if the controller does not have its
-		// own _output() method and we are not dealing with a cache file, which we
-		// can determine by the existence of the $CI object above
-		if ($this->cache_expiration > 0 && isset($CI) && ! method_exists($CI, '_output'))
-		{
-			$this->_write_cache($output);
-		}
-
-		// --------------------------------------------------------------------
-
-		// Parse out the elapsed time and memory usage,
-		// then swap the pseudo-variables with the data
-
-		$elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end');
-
-		if ($this->parse_exec_vars === TRUE)
-		{
-			$memory	 = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB';
-
-			$output = str_replace('{elapsed_time}', $elapsed, $output);
-			$output = str_replace('{memory_usage}', $memory, $output);
-		}
-
-		// --------------------------------------------------------------------
-
-		// Is compression requested?
-		if ($CFG->item('compress_output') === TRUE && $this->_zlib_oc == FALSE)
-		{
-			if (extension_loaded('zlib'))
-			{
-				if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) AND strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE)
-				{
-					ob_start('ob_gzhandler');
-				}
-			}
-		}
-
-		// --------------------------------------------------------------------
-
-		// Are there any server headers to send?
-		if (count($this->headers) > 0)
-		{
-			foreach ($this->headers as $header)
-			{
-				@header($header[0], $header[1]);
-				log_message('debug', "header '$header[0], $header[1]' set.");
-			}
-		}
-
-		// --------------------------------------------------------------------
-
-		// Are there any cookies to set?
-		if (count($this->cookies) > 0)
-		{
-			foreach ($this->cookies as $cookie)
-			{
-				call_user_func_array ( 'setcookie' , $cookie );
-				log_message('debug', "cookie '".join(', ', $cookie)."' set.");
-			}
-		}
-
-
-		// --------------------------------------------------------------------
-
-		// If not we know we are dealing with a cache file so we'll
-		// simply echo out the data and exit.
-		if ( ! isset($CI))
-		{
-			echo $output;
-			log_message('debug', "Final output sent to browser");
-			log_message('debug', "Total execution time: ".$elapsed);
-			return TRUE;
-		}
-
-		// --------------------------------------------------------------------
-
-		// Do we need to generate profile data?
-		// If so, load the Profile class and run it.
-		if ($this->enable_profiler == TRUE)
-		{
-			$CI->load->library('profiler');
-
-			if ( ! empty($this->_profiler_sections))
-			{
-				$CI->profiler->set_sections($this->_profiler_sections);
-			}
-
-			// If the output data contains closing </body> and </html> tags
-			// we will remove them and add them back after we insert the profile data
-			if (preg_match("|</body>.*?</html>|is", $output))
-			{
-				$output = preg_replace("|</body>.*?</html>|is", '', $output);
-				$output .= $CI->profiler->run();
-				$output .= '</body></html>';
-			}
-			else
-			{
-				$output .= $CI->profiler->run();
-			}
-		}
-
-		// --------------------------------------------------------------------
-
-		// Does the controller contain a function named _output()?
-		// If so send the output there. Otherwise, echo it.
-		if (method_exists($CI, '_output'))
-		{
-			$CI->_output($output);
-		}
-		else
-		{
-			echo $output; // Send it to the browser!
-		}
-
-		log_message('debug', "Final output sent to browser");
-		log_message('debug', "Total execution time: ".$elapsed);
-	}
-
-	// --------------------------------------------------------------------
-}
-
-/* End of file CIU_Output_CI_Output.php */
-/* Location: ./application/third_party/CIUnit/core/CIU_Output_CI_Output.php */

application/third_party/CIUnit/core/CIU_Output_MY_Output.php

-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-
-/*
-* fooStack, CIUnit for CodeIgniter
-* Copyright (c) 2008-2009 Clemens Gruenberger
-* Released under the MIT license, see:
-* http://www.opensource.org/licenses/mit-license.php
-*/
-
-/*
-* CodeIgniter source modified for fooStack / CIUnit
-* CIU_Output_CI_Output.php and CIU_Output_MY_Output.php are the same except parent class.
-*/
-
-class CIU_Output extends MY_Output {
-
-	function __construct()
-	{
-		parent::__construct();
-		$this->final_output = ''; //would be just set to 'null' in CI_Output
-		$this->_ci_ob_level  = ob_get_level();
-		$this->cookies = array();
-	}
-
-	/**
-	* store cookie headers
-	*/
-	function set_cookie($arr)
-	{
-		if ( ! is_array($arr))
-		{
-			$arr = func_get_args();
-		}
-		$this->cookies[] = $arr;
-	}
-
-	/**
-	* Add to instead of replace final output
-	*/
-	function add_output($str)
-	{
-		$this->final_output .= $str;
-	}
-
-	/**
-	* Pop Output
-	*
-	* The final output the output class has stringed together is returned and truncated
-	*
-	*/
-	function pop_output()
-	{
-		$output = $this->final_output;
-		$this->final_output = "";
-		return $output;
-	}
-
-	/**
-	* set_no_cache_headers
-	* called as a post controller construction hook
-	* should count therefore as controller duty
-	*/
-	function set_no_cache_headers()
-	{
-		//somehow $this can't be used as headers are not set in that case
-		$CI =& get_instance();
-		$CI->output->soft_set_header('Content-type: text/html; charset=utf-8');
-		$CI->output->soft_set_header('Cache-Control: no-cache');
-		log_message('debug', 'no cache headers set in output class');
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
-	 * sets headers if not already set
-	 */
-	function soft_set_header($header)
-	{
-		$key = strtolower(array_shift(split(':', $header)));
-		$add = true;
-		foreach($this->headers as $hdr)
-		{
-			$h = split(':', $hdr);
-			if(strtolower(array_shift($h)) == $key)
-			{
-				$add = false;
-			}
-		}
-		$add ? ($this->headers[] = $header) : '';
-	}
-
-	/**
-	* say
-	* like normal echo but puts it in the output_buffer first, so we still can set headers
-	* and post process it
-	*/
-	function say($str)
-	{
-		ob_start();
-		echo $str;
-		$this->ob_flush_clean();
-	}
-
-	/**
-	* ob_flush_clean
-	* flushes or cleans the buffer depending on if we are finished outputting or still on a nested level
-	*/
-	function ob_flush_clean()
-	{
-		$CI =& get_instance();
-		if (ob_get_level() > $this->_ci_ob_level + 1)
-		{
-			ob_end_flush();
-		}
-		else
-		{
-			$this->add_output(ob_get_contents());
-			@ob_end_clean();
-		}
-	}
-
-	/**
-	 * Display Output
-	 *
-	 * All "view" data is automatically put into this variable by the controller class:
-	 *
-	 * $this->final_output
-	 *
-	 * This function sends the finalized output data to the browser along
-	 * with any server headers and profile data. It also stops the
-	 * benchmark timer so the page rendering speed and memory usage can be shown.
-	 *
-	 * @access	public
-	 * @return	mixed
-	 */
-	function _display($output = '')
-	{
-		// Note: We use globals because we can't use $CI =& get_instance()
-		// since this function is sometimes called by the caching mechanism,
-		// which happens before the CI super object is available.
-		global $BM, $CFG;
-
-		// Grab the super object if we can.
-		if (class_exists('CI_Controller'))
-		{
-			$CI =& get_instance();
-		}
-
-		// --------------------------------------------------------------------
-
-		// Set the output data
-		if ($output == '')
-		{
-			$output =& $this->final_output;
-		}
-
-		// --------------------------------------------------------------------
-
-		// Do we need to write a cache file? Only if the controller does not have its
-		// own _output() method and we are not dealing with a cache file, which we
-		// can determine by the existence of the $CI object above
-		if ($this->cache_expiration > 0 && isset($CI) && ! method_exists($CI, '_output'))
-		{
-			$this->_write_cache($output);
-		}
-
-		// --------------------------------------------------------------------
-
-		// Parse out the elapsed time and memory usage,
-		// then swap the pseudo-variables with the data
-
-		$elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end');
-
-		if ($this->parse_exec_vars === TRUE)
-		{
-			$memory	 = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB';
-
-			$output = str_replace('{elapsed_time}', $elapsed, $output);
-			$output = str_replace('{memory_usage}', $memory, $output);
-		}
-
-		// --------------------------------------------------------------------
-
-		// Is compression requested?
-		if ($CFG->item('compress_output') === TRUE && $this->_zlib_oc == FALSE)
-		{
-			if (extension_loaded('zlib'))
-			{
-				if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) AND strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE)
-				{
-					ob_start('ob_gzhandler');
-				}
-			}
-		}
-
-		// --------------------------------------------------------------------
-
-		// Are there any server headers to send?
-		if (count($this->headers) > 0)
-		{
-			foreach ($this->headers as $header)
-			{
-				@header($header[0], $header[1]);
-				log_message('debug', "header '$header[0], $header[1]' set.");
-			}
-		}
-
-		// --------------------------------------------------------------------
-
-		// Are there any cookies to set?
-		if (count($this->cookies) > 0)
-		{
-			foreach ($this->cookies as $cookie)
-			{
-				call_user_func_array ( 'setcookie' , $cookie );
-				log_message('debug', "cookie '".join(', ', $cookie)."' set.");
-			}
-		}
-
-
-		// --------------------------------------------------------------------
-
-		// If not we know we are dealing with a cache file so we'll
-		// simply echo out the data and exit.
-		if ( ! isset($CI))
-		{
-			echo $output;
-			log_message('debug', "Final output sent to browser");
-			log_message('debug', "Total execution time: ".$elapsed);
-			return TRUE;
-		}
-
-		// --------------------------------------------------------------------
-
-		// Do we need to generate profile data?
-		// If so, load the Profile class and run it.
-		if ($this->enable_profiler == TRUE)
-		{
-			$CI->load->library('profiler');
-
-			if ( ! empty($this->_profiler_sections))
-			{
-				$CI->profiler->set_sections($this->_profiler_sections);
-			}
-
-			// If the output data contains closing </body> and </html> tags
-			// we will remove them and add them back after we insert the profile data
-			if (preg_match("|</body>.*?</html>|is", $output))
-			{
-				$output = preg_replace("|</body>.*?</html>|is", '', $output);
-				$output .= $CI->profiler->run();
-				$output .= '</body></html>';
-			}
-			else
-			{
-				$output .= $CI->profiler->run();
-			}
-		}
-
-		// --------------------------------------------------------------------
-
-		// Does the controller contain a function named _output()?
-		// If so send the output there. Otherwise, echo it.
-		if (method_exists($CI, '_output'))
-		{
-			$CI->_output($output);
-		}
-		else
-		{
-			echo $output; // Send it to the browser!
-		}
-
-		log_message('debug', "Final output sent to browser");
-		log_message('debug', "Total execution time: ".$elapsed);
-	}
-
-	// --------------------------------------------------------------------
-}
-
-/* End of file CIU_Output_MY_Output.php */
-/* Location: ./application/third_party/CIUnit/core/CIU_Output_MY_Output.php */

application/third_party/CIUnit/libraries/CIU_Session.php

+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+/*
+* CodeIgniter source modified for CIUnit
+* 
+* If you use MY_Session, change the paraent class.
+*/
+
+class CIU_Session extends CI_Session {
+
+	/**
+	 * Destroy the current session
+	 *
+	 * @access	public
+	 * @return	void
+	 */
+	function sess_destroy()
+	{
+		// Kill the session DB row
+		if ($this->sess_use_database === TRUE AND isset($this->userdata['session_id']))
+		{
+			$this->CI->db->where('session_id', $this->userdata['session_id']);
+			$this->CI->db->delete($this->sess_table_name);
+		}
+
+		// Kill the cookie: modified for CIUnit
+		$array = array(
+					$this->sess_cookie_name,
+					addslashes(serialize(array())),
+					($this->now - 31500000),
+					$this->cookie_path,
+					$this->cookie_domain,
+					0
+				);
+		$this->CI->output->set_cookie($array);
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Write the session cookie
+	 *
+	 * @access	public
+	 * @return	void
+	 */
+	f