public function testAutoload()
 {
     $autoloader = new StandardAutoloader();
     //add namespace and register the autoloader
     $autoloader->addNamespace('Bumble\\Test\\NS', __DIR__ . '/Test/NS/');
     $autoloader->register();
     //test our class exists
     $this->assertTrue(class_exists('\\Bumble\\Test\\NS\\Foo'));
 }
Example #2
0
    /**
     * Get an instance of the standard autoloader
     *
     * Used to attempt to resolve autoloader classes, using the 
     * StandardAutoloader. The instance is marked as a fallback autoloader, to 
     * allow resolving autoloaders not under the "Zend" namespace.
     * 
     * @return SplAutoloader
     */
    protected static function getStandardAutoloader()
    {
        if (null !== static::$standardAutoloader) {
            return static::$standardAutoloader;
        }

        require_once __DIR__ . '/StandardAutoloader.php';
        $loader = new StandardAutoloader();
        $loader->setFallbackAutoloader(true);
        static::$standardAutoloader = $loader;
        return static::$standardAutoloader;
    }