tims-todo/tests/env/autoloader.php

32 lines
542 B
PHP
Raw Permalink Normal View History

2014-08-08 15:41:59 -04:00
<?php
/**
* Autoloader for test suite
*/
spl_autoload_register(function($class) {
$paths = [
'application/controllers',
'application/models',
'application/libraries',
'application/core',
'system/core',
'system/libraries'
2014-08-08 15:41:59 -04:00
];
foreach($paths as $path)
{
$path = __DIR__ . "/../../{$path}/";
2014-08-08 15:41:59 -04:00
$exact_file = "{$path}{$class}.php";
$lower_file = $path . mb_strtolower($class) . ".php";
foreach([$lower_file, $exact_file] as $file)
2014-08-08 15:41:59 -04:00
{
if (file_exists($file))
{
require_once($file);
return;
}
2014-08-08 15:41:59 -04:00
}
}
});