/** * LoadClass will return null when the resolved file for that class can * not be found * * Note: whenever we clear the autoloader when can not run any phpunit * classes because its autoloader is cleared. So we save the results, * restore the autoloaders and then test the results. * * @depends testInterface * @return null */ public function testLoadClassNotFound() { $class = 'TestFuel\\Fake\\ClassLoader\\LoadMeNotFound'; $this->assertNotContains($class, get_declared_classes()); $this->clearAutoloaders(); $this->loader->addPath(AF_LIB_PATH); $this->loader->register(); $result = $this->loader->loadClass($class); $this->restoreAutoloaders(); $this->assertNull($result); $this->assertNotContains($class, get_declared_classes()); }
/** * This will only register the appfuel standard autoloader. If you * what your own autoloader without appfuels then in the config * use enable-af-autoloader = false * * @return KernelInitializer */ public function initAppfuelAutoloader() { $isAutoloader = KernelRegistry::getParam('enable-af-autoloader', true); if (false == $isAutoloader) { return $this; } $loader = new StandardAutoLoader(AF_LIB_PATH); $loader->register(); $msg = "appfuel autoloader initialized"; self::$status['kernel:autolaoder'] = $msg; return $this; }