/** * Test if the autoloader skips a class which doesn't match the registered namespaces. */ public function testSkipsClassNotInRegisteredNamespaces() { $this->autoLoader = new ClassAutoloader(); $this->autoLoader->registerNamespace('com\\mohiva\\test\\resources\\common\\not\\existing'); $this->autoLoader->register(); $this->assertFalse(class_exists('com\\mohiva\\test\\resources\\common\\io\\ClassNotInRegisteredNamespaces', true)); }
/** * Setup the class autoloader for all mohiva related files. */ private static function setupClassAutoloader() { /** @noinspection PhpIncludeInspection */ require_once 'com/mohiva/common/io/ClassAutoloader.php'; self::$autoloader = new ClassAutoloader(); self::$autoloader->setPolicy(ClassAutoloader::POLICY_EXCEPTION); self::$autoloader->registerNamespace('com\\mohiva'); self::$autoloader->register(); }