예제 #1
0
 /**
  * Tests that when registering that NIMBLES_PATH is made the first include path
  * @return void
  */
 public function testRegister()
 {
     $includepaths = explode(PATH_SEPARATOR, get_include_path());
     foreach ($includepaths as $index => $path) {
         if (NIMBLES_PATH === $path) {
             unset($includepaths[$index]);
             break;
         }
     }
     set_include_path(implode(PATH_SEPARATOR, $includepaths));
     $functions = spl_autoload_functions();
     if (is_array($functions) && 'Nimbles\\Core\\Loader' === $functions[0][0]) {
         spl_autoload_unregister('Nimbles\\Core\\Loader::autoload');
     }
     if (false === ($functions = spl_autoload_functions())) {
         $functions = array();
     }
     array_unshift($includepaths, NIMBLES_PATH);
     \Nimbles\Core\Loader::register();
     $this->assertSame($includepaths, explode(PATH_SEPARATOR, get_include_path()));
     if (function_exists('spl_autoload_case_sensitive')) {
         $autoload = 'spl_autoload';
     } else {
         $autoload = array('Nimbles\\Core\\Loader', 'autoload');
     }
     $registered = spl_autoload_functions();
     $this->assertContains($autoload, $registered);
 }
예제 #2
0
 /**
  * Class construct
  * @return void
  */
 public function __construct()
 {
     if (null === static::$_instance) {
         $this->_setupEnvironmentVars();
         \Nimbles\Core\Loader::register();
         static::$_instance = $this;
     }
 }