Created
September 21, 2011 08:05
-
-
Save kenjis/1231528 to your computer and use it in GitHub Desktop.
PHPUnit for CodeIgniter Unit Testing class: http://d.hatena.ne.jp/Kenji_s/20110921/1316593782
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('BASEPATH', dirname(__FILE__) . '/../system/'); | |
define('APPPATH', dirname(__FILE__) . '/../application/'); | |
function autoload_core($class_name) | |
{ | |
$file_name = $class_name; | |
if (substr($class_name, 0, 3) === 'CI_') | |
{ | |
$file_name = substr($file_name, 3); | |
} | |
$file = BASEPATH . 'core/' . $file_name . '.php'; | |
if (file_exists($file)) | |
{ | |
require_once $file; | |
} | |
} | |
function autoload_model($class_name) | |
{ | |
$file_name = strtolower($class_name); | |
$file = APPPATH . 'models/' . $file_name . '.php'; | |
if (file_exists($file)) | |
{ | |
require_once $file; | |
} | |
} | |
spl_autoload_register('autoload_core'); | |
spl_autoload_register('autoload_model'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment