parent
b6fdbf055e
commit
13fc7e16f2
|
@ -80,7 +80,7 @@ abstract class ApplicationBootstrap
|
|||
/**
|
||||
* Icinga auto loader
|
||||
*
|
||||
* @var Loader
|
||||
* @var ClassLoader
|
||||
*/
|
||||
private $loader;
|
||||
|
||||
|
@ -183,7 +183,7 @@ abstract class ApplicationBootstrap
|
|||
/**
|
||||
* Getter for class loader
|
||||
*
|
||||
* @return Loader
|
||||
* @return ClassLoader
|
||||
*/
|
||||
public function getLoader()
|
||||
{
|
||||
|
@ -345,9 +345,9 @@ abstract class ApplicationBootstrap
|
|||
*/
|
||||
public function setupAutoloader()
|
||||
{
|
||||
require $this->libDir . '/Icinga/Application/Loader.php';
|
||||
require $this->libDir . '/Icinga/Application/ClassLoader.php';
|
||||
|
||||
$this->loader = new Loader();
|
||||
$this->loader = new ClassLoader();
|
||||
$this->loader->registerNamespace('Icinga', $this->libDir. '/Icinga');
|
||||
$this->loader->register();
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Icinga\Application;
|
|||
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
|
||||
class Loader
|
||||
class ClassLoader
|
||||
{
|
||||
/**
|
||||
* Namespace separator
|
|
@ -22,9 +22,9 @@ require_once 'Mockery/Loader.php';
|
|||
$mockeryLoader = new \Mockery\Loader;
|
||||
$mockeryLoader->register();
|
||||
|
||||
require_once($libraryPath . '/Icinga/Application/Loader.php');
|
||||
require_once($libraryPath . '/Icinga/Application/ClassLoader.php');
|
||||
|
||||
$loader = new Icinga\Application\Loader();
|
||||
$loader = new Icinga\Application\ClassLoader();
|
||||
$loader->registerNamespace('Tests', $testLibraryPath);
|
||||
$loader->registerNamespace('Icinga', $libraryPath . '/Icinga');
|
||||
$loader->registerNamespace('Icinga\\Forms', $applicationPath . '/forms');
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace Tests\Icinga\Application;
|
||||
|
||||
use Icinga\Test\BaseTestCase;
|
||||
use Icinga\Application\Loader;
|
||||
use Icinga\Application\ClassLoader;
|
||||
|
||||
class LoaderTest extends BaseTestCase
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ EOD;
|
|||
|
||||
public function testObjectCreation1()
|
||||
{
|
||||
$loader = new Loader();
|
||||
$loader = new ClassLoader();
|
||||
$loader->register();
|
||||
|
||||
$check = false;
|
||||
|
@ -71,7 +71,7 @@ EOD;
|
|||
|
||||
public function testNamespaces()
|
||||
{
|
||||
$loader = new Loader();
|
||||
$loader = new ClassLoader();
|
||||
$loader->registerNamespace('Test\\Laola', '/tmp');
|
||||
$loader->registerNamespace('Dings\\Var', '/var/tmp');
|
||||
|
||||
|
@ -89,7 +89,7 @@ EOD;
|
|||
$classFile = $this->baseDir. self::$classFile;
|
||||
$this->assertFileExists($classFile);
|
||||
|
||||
$loader = new Loader();
|
||||
$loader = new ClassLoader();
|
||||
$loader->registerNamespace('My\\Library', dirname($classFile));
|
||||
$this->assertFalse($loader->loadClass('DOES\\NOT\\EXISTS'));
|
||||
$this->assertTrue($loader->loadClass('My\\Library\\TestStruct'));
|
||||
|
@ -100,7 +100,7 @@ EOD;
|
|||
$classFile = $this->baseDir. self::$classFile;
|
||||
$this->assertFileExists($classFile);
|
||||
|
||||
$loader = new Loader();
|
||||
$loader = new ClassLoader();
|
||||
$loader->registerNamespace('My\\Library', dirname($classFile));
|
||||
$loader->register();
|
||||
|
||||
|
@ -113,7 +113,7 @@ EOD;
|
|||
*/
|
||||
public function testNonexistingDirectory()
|
||||
{
|
||||
$loader = new Loader();
|
||||
$loader = new ClassLoader();
|
||||
$loader->registerNamespace('My\\Library', '/trullalla/123');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue