parent
5ecde41ba3
commit
234dc951d2
|
@ -29,18 +29,9 @@ class ClassLoader
|
||||||
* @param string $directory
|
* @param string $directory
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
* @throws ProgrammingError
|
|
||||||
*/
|
*/
|
||||||
public function registerNamespace($namespace, $directory)
|
public function registerNamespace($namespace, $directory)
|
||||||
{
|
{
|
||||||
if (!is_dir($directory)) {
|
|
||||||
throw new ProgrammingError(
|
|
||||||
'Directory "%s" for namespace "%s" does not exist',
|
|
||||||
$directory,
|
|
||||||
$namespace
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->namespaces[$namespace] = $directory;
|
$this->namespaces[$namespace] = $directory;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -107,13 +107,4 @@ EOD;
|
||||||
$o = new \My\Library\TestStruct();
|
$o = new \My\Library\TestStruct();
|
||||||
$this->assertTrue($o->testFlag());
|
$this->assertTrue($o->testFlag());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException Icinga\Exception\ProgrammingError
|
|
||||||
*/
|
|
||||||
public function testNonexistingDirectory()
|
|
||||||
{
|
|
||||||
$loader = new ClassLoader();
|
|
||||||
$loader->registerNamespace('My\\Library', '/trullalla/123');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue