Run unit tests across different database backends + fix bugs
This commit is contained in:
@@ -10,18 +10,30 @@ namespace Core;
|
||||
*/
|
||||
class Loader
|
||||
{
|
||||
/**
|
||||
* List of paths
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $paths = array();
|
||||
|
||||
/**
|
||||
* Load the missing class
|
||||
*
|
||||
* @access public
|
||||
* @param string $class Class name
|
||||
* @param string $class Class name with namespace
|
||||
*/
|
||||
public function load($class)
|
||||
{
|
||||
$filename = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
|
||||
foreach ($this->paths as $path) {
|
||||
|
||||
if (file_exists($filename)) {
|
||||
require $filename;
|
||||
$filename = $path.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
|
||||
|
||||
if (file_exists($filename)) {
|
||||
require $filename;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +46,17 @@ class Loader
|
||||
{
|
||||
spl_autoload_register(array($this, 'load'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new path
|
||||
*
|
||||
* @access public
|
||||
* @param string $path Path
|
||||
* @return Core\Loader
|
||||
*/
|
||||
public function setPath($path)
|
||||
{
|
||||
$this->paths[] = $path;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user