public function tearDown() { // Restore original autoloaders AutoloaderFactory::unregisterAutoloaders(); $loaders = spl_autoload_functions(); if (is_array($loaders)) { foreach ($loaders as $loader) { spl_autoload_unregister($loader); } } foreach ($this->loaders as $loader) { spl_autoload_register($loader); } // Restore original include_path set_include_path($this->includePath); }
public function tearDown() { $file = glob($this->tmpdir . DIRECTORY_SEPARATOR . '*'); @unlink($file[0]); // change this if there's ever > 1 file @rmdir($this->tmpdir); // Restore original autoloaders AutoloaderFactory::unregisterAutoloaders(); $loaders = spl_autoload_functions(); if (is_array($loaders)) { foreach ($loaders as $loader) { spl_autoload_unregister($loader); } } foreach ($this->loaders as $loader) { spl_autoload_register($loader); } // Restore original include_path set_include_path($this->includePath); }
public function testCanUnregisterAutoloaders() { AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('namespaces' => array('TestNamespace' => __DIR__ . '/TestAsset/TestNamespace')))); AutoloaderFactory::unregisterAutoloaders(); $this->assertEquals(0, count(AutoloaderFactory::getRegisteredAutoloaders())); }