/** * @return void * @covers \pdepend\reflection\Autoloader * @group reflection * @group unittest */ public function testAutoloaderIncludesMatchingSourceFile() { $classFixture = '\\pdepend\\reflection\\autoloader\\Test'; if (class_exists($classFixture, false)) { $this->fail('Class ' . $classFixture . ' should not exist'); } $autoloader = new Autoloader(__DIR__ . '/_source/'); $autoloader->autoload($classFixture); $this->assertTrue(class_exists($classFixture, false), 'Class should exist ' . $classFixture); }
/** * 运行一个请求生命周期 * @access public * @author songdengtao <http://www.songdengtao.cn> * @return void */ public static function run() { // 系统注册表 Registry::init(static::get('registryPath')); // 运行环境检查 static::checkEnv(); // 类文件自动加载 Autoloader::init(static::getInstance()); Autoloader::autoload(); // 设置系统时区 static::shell('Dtime::setDateDefaultTimeZone'); // 设置错误处理方法 static::shell('Error::registerShutdownFunction'); static::shell('Error::setErrorHandler'); // 设置异常处理方法 static::shell('Exception::setExceptionHandler'); if (false === static::get('isCli')) { static::shell('Filter::globalFilter'); static::shell('Session::start'); } // 路由 static::shell('Router::dispatch'); $controller = CONTROLLER_NAME . 'Controller'; $action = ACTION_NAME . 'Action'; $class = CONTROLLER_NAMESPACE . '\\' . $controller; if (!class_exists($class)) { $class = CONTROLLER_NAMESPACE . '\\EmptyController'; if (!class_exists($class)) { $module = strstr(CONTROLLER_NAMESPACE, '\\', true); if (static::get('debug')) { if (!is_dir(static::get('appPath') . $module)) { static::shell('Error::halt', 'Call to undefined module ' . $module); } else { static::shell('Error::halt', 'Call to undefined controller ' . $class); } } else { static::shell('Error::halt', '404 Not found'); } } } (new $class())->{$action}(); return; }
public function testNoExceptionForBitpayClasslike() { Autoloader::register(); // Magento Classes Autoloader::autoload('Bitpay_Core_Model'); }
public static function setUpBeforeClass() { // Load the class file, which contains some supporting classes Autoloader::autoload('Ldap'); self::$ldapInstalled = function_exists('ldap_connect'); }