Sets the {@link \ProxyManager\Autoloader\AutoloaderInterface} that should be
used by ProxyManager to load the generated classes.
public setProxyAutoloader ( ProxyManager\Autoloader\AutoloaderInterface $autoloader ) | ||
$autoloader | ProxyManager\Autoloader\AutoloaderInterface |
/** * @test */ public function enablingProxyAutoloaderRegistersAdditionalAutoloader() { $autoloader = new Autoloader(new FileLocator(sys_get_temp_dir()), new ClassNameInflector('AUTOLOADER')); $autoloaderFunctionsBeforeBeanFactoryInit = spl_autoload_functions(); $beanFactoryConfig = new BeanFactoryConfiguration(sys_get_temp_dir()); $beanFactoryConfig->setProxyAutoloader($autoloader); $autoloaderFunctionsAfterBeanFactoryInit = spl_autoload_functions(); self::assertCount(count($autoloaderFunctionsBeforeBeanFactoryInit) + 1, $autoloaderFunctionsAfterBeanFactoryInit); }
public function createDiscoInstance(bool $useAutoloader = false) : AnnotationBeanFactory { $config = new BeanFactoryConfiguration(sys_get_temp_dir()); if ($useAutoloader) { $config->setProxyAutoloader(new Autoloader(new FileLocator(sys_get_temp_dir()), new ClassNameInflector('Bench'))); } $disco = new AnnotationBeanFactory(BenchmarkConfiguration::class, [], $config); BeanFactoryRegistry::register($disco); return $disco; }