Пример #1
0
 /**
  * @param	string	$rootPath
  * @return	ClassDependency
  */
 public function __construct($rootPath = null)
 {
     if (!defined('AF_LIB_PATH')) {
         $err = 'constant AF_BASE_PATH must be defined before loading ';
         $err .= 'dependencies';
         throw new RunTimeException($err);
     }
     parent::__construct(AF_LIB_PATH);
     $dependencies = array('\\Appfuel\\Error\\ErrorInterface', '\\Appfuel\\Error\\ErrorStackInterface', '\\Appfuel\\Error\\ErrorItem', '\\Appfuel\\Error\\ErrorStack', '\\Appfuel\\DataStructure\\DictionaryInterface', '\\Appfuel\\DataStructure\\Dictionary', '\\Appfuel\\Console\\ConsoleOutputInterface', '\\Appfuel\\Console\\ConsoleOutput', '\\Appfuel\\Http\\HttpOutputInterface', '\\Appfuel\\Http\\HttpOutput', '\\Appfuel\\Kernel\\KernelRegistry', '\\Appfuel\\Kernel\\Error\\ErrorLevelInterface', '\\Appfuel\\Kernel\\Error\\ErrorLevel', '\\Appfuel\\Kernel\\Error\\ErrorDisplayInterface', '\\Appfuel\\Kernel\\Error\\ErrorDisplay', '\\Appfuel\\Kernel\\IncludePathInterface', '\\Appfuel\\Kernel\\IncludePath', '\\Appfuel\\Kernel\\KernelRegistry', '\\Appfuel\\Kernel\\Startup\\StartupTaskInterface', '\\Appfuel\\Kernel\\Startup\\StartupTaskAbstract', '\\Appfuel\\Kernel\\FaultHandlerInterface', '\\Appfuel\\Kernel\\FaultHandler', '\\Appfuel\\Log\\LogPriorityInterface', '\\Appfuel\\Log\\LogEntryInterface', '\\Appfuel\\Log\\LogAdapterInterface', '\\Appfuel\\Log\\LoggerInterface', '\\Appfuel\\Log\\SysLogAdapter', '\\Appfuel\\Log\\LogEntry', '\\Appfuel\\Log\\LogPriority', '\\Appfuel\\Log\\Logger');
     $this->loadNamespaces($dependencies);
 }
Пример #2
0
 /**
  * Dependency Loader will throw an exception for any file it can not find
  *
  * @expectedException	RunTimeException
  * @depends				testDependencies
  * @return				null
  */
 public function testLoadDependencyClassNotFound()
 {
     $dependency = new ClassDependency(AF_LIB_PATH);
     $list = array('TestFuel\\Fake\\ClassLoader\\IsNotHere');
     $dependency->loadNamespaces($list);
     $declared = get_declared_classes();
     foreach ($list as $ns) {
         $this->assertNotContains($ns, $declared);
     }
     $this->clearAutoLoaders();
     $result = $this->loader->loadDependency($dependency);
     $this->restoreAutoLoaders();
     $this->assertNull($result);
     $declared = get_declared_classes();
     foreach ($list as $ns) {
         $this->assertContains($ns, $declared);
     }
 }
Пример #3
0
 /**
  * @return	null
  */
 public function testConstructRootPath()
 {
     /* empty string is allowed */
     $path = '';
     $dependency = new ClassDependency($path);
     $this->assertEquals($path, $dependency->getRootPath());
     /* any padding will be trimed */
     $path = ' /root/path';
     $dependency = new ClassDependency($path);
     $this->assertEquals(trim($path), $dependency->getRootPath());
     $path = "\t /root/path/ \t";
     $dependency = new ClassDependency($path);
     $this->assertEquals(trim($path), $dependency->getRootPath());
 }