Rename Loader to ClassLoader

refs #5786
This commit is contained in:
Eric Lippmann 2015-08-18 09:06:58 +02:00
parent b6fdbf055e
commit 13fc7e16f2
4 changed files with 13 additions and 13 deletions

View File

@ -80,7 +80,7 @@ abstract class ApplicationBootstrap
/** /**
* Icinga auto loader * Icinga auto loader
* *
* @var Loader * @var ClassLoader
*/ */
private $loader; private $loader;
@ -183,7 +183,7 @@ abstract class ApplicationBootstrap
/** /**
* Getter for class loader * Getter for class loader
* *
* @return Loader * @return ClassLoader
*/ */
public function getLoader() public function getLoader()
{ {
@ -345,9 +345,9 @@ abstract class ApplicationBootstrap
*/ */
public function setupAutoloader() 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->registerNamespace('Icinga', $this->libDir. '/Icinga');
$this->loader->register(); $this->loader->register();

View File

@ -5,7 +5,7 @@ namespace Icinga\Application;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
class Loader class ClassLoader
{ {
/** /**
* Namespace separator * Namespace separator

View File

@ -22,9 +22,9 @@ require_once 'Mockery/Loader.php';
$mockeryLoader = new \Mockery\Loader; $mockeryLoader = new \Mockery\Loader;
$mockeryLoader->register(); $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('Tests', $testLibraryPath);
$loader->registerNamespace('Icinga', $libraryPath . '/Icinga'); $loader->registerNamespace('Icinga', $libraryPath . '/Icinga');
$loader->registerNamespace('Icinga\\Forms', $applicationPath . '/forms'); $loader->registerNamespace('Icinga\\Forms', $applicationPath . '/forms');

View File

@ -4,7 +4,7 @@
namespace Tests\Icinga\Application; namespace Tests\Icinga\Application;
use Icinga\Test\BaseTestCase; use Icinga\Test\BaseTestCase;
use Icinga\Application\Loader; use Icinga\Application\ClassLoader;
class LoaderTest extends BaseTestCase class LoaderTest extends BaseTestCase
{ {
@ -43,7 +43,7 @@ EOD;
public function testObjectCreation1() public function testObjectCreation1()
{ {
$loader = new Loader(); $loader = new ClassLoader();
$loader->register(); $loader->register();
$check = false; $check = false;
@ -71,7 +71,7 @@ EOD;
public function testNamespaces() public function testNamespaces()
{ {
$loader = new Loader(); $loader = new ClassLoader();
$loader->registerNamespace('Test\\Laola', '/tmp'); $loader->registerNamespace('Test\\Laola', '/tmp');
$loader->registerNamespace('Dings\\Var', '/var/tmp'); $loader->registerNamespace('Dings\\Var', '/var/tmp');
@ -89,7 +89,7 @@ EOD;
$classFile = $this->baseDir. self::$classFile; $classFile = $this->baseDir. self::$classFile;
$this->assertFileExists($classFile); $this->assertFileExists($classFile);
$loader = new Loader(); $loader = new ClassLoader();
$loader->registerNamespace('My\\Library', dirname($classFile)); $loader->registerNamespace('My\\Library', dirname($classFile));
$this->assertFalse($loader->loadClass('DOES\\NOT\\EXISTS')); $this->assertFalse($loader->loadClass('DOES\\NOT\\EXISTS'));
$this->assertTrue($loader->loadClass('My\\Library\\TestStruct')); $this->assertTrue($loader->loadClass('My\\Library\\TestStruct'));
@ -100,7 +100,7 @@ EOD;
$classFile = $this->baseDir. self::$classFile; $classFile = $this->baseDir. self::$classFile;
$this->assertFileExists($classFile); $this->assertFileExists($classFile);
$loader = new Loader(); $loader = new ClassLoader();
$loader->registerNamespace('My\\Library', dirname($classFile)); $loader->registerNamespace('My\\Library', dirname($classFile));
$loader->register(); $loader->register();
@ -113,7 +113,7 @@ EOD;
*/ */
public function testNonexistingDirectory() public function testNonexistingDirectory()
{ {
$loader = new Loader(); $loader = new ClassLoader();
$loader->registerNamespace('My\\Library', '/trullalla/123'); $loader->registerNamespace('My\\Library', '/trullalla/123');
} }
} }