public function test_with_custom_parameters() { $this->builder->with_custom_parameters(array('my_parameter' => true)); $container = $this->builder->get_container(); $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\ContainerBuilder', $container); $this->assertTrue($container->hasParameter('my_parameter')); }
/** * Load the enabled extensions. */ protected function load_extensions() { if ($this->config_php_file !== null) { // Build an intermediate container to load the ext list from the database $container_builder = new container_builder($this->phpbb_root_path, $this->php_ext); $ext_container = $container_builder->without_cache()->without_extensions()->with_config($this->config_php_file)->with_environment('production')->without_compiled_container()->get_container(); $ext_container->register('cache.driver', '\\phpbb\\cache\\driver\\dummy'); $ext_container->compile(); $extensions = $ext_container->get('ext.manager')->all_enabled(); // Load each extension found foreach ($extensions as $ext_name => $path) { $extension_class = '\\' . str_replace('/', '\\', $ext_name) . '\\di\\extension'; if (!class_exists($extension_class)) { $extension_class = '\\phpbb\\extension\\di\\extension_base'; } $this->container_extensions[] = new $extension_class($ext_name, $path); // Load extension autoloader $filename = $path . 'vendor/autoload.php'; if (file_exists($filename)) { require $filename; } } } else { // To load the extensions we need the database credentials. // Automatically disable the extensions if we don't have them. $this->use_extensions = false; } }
/** * Load the enabled extensions. */ protected function load_extensions() { if ($this->config_php_file !== null) { // Build an intermediate container to load the ext list from the database $container_builder = new container_builder($this->phpbb_root_path, $this->php_ext); $ext_container = $container_builder->without_cache()->without_extensions()->with_config($this->config_php_file)->with_config_path($this->get_config_path())->with_environment('production')->without_compiled_container()->get_container(); $ext_container->register('cache.driver', '\\phpbb\\cache\\driver\\dummy'); $ext_container->compile(); $extensions = $ext_container->get('ext.manager')->all_enabled(); // Load each extension found $autoloaders = '<?php /** * Loads all extensions custom auto-loaders. * * This file has been auto-generated * by phpBB while loading the extensions. */ '; foreach ($extensions as $ext_name => $path) { $extension_class = '\\' . str_replace('/', '\\', $ext_name) . '\\di\\extension'; if (!class_exists($extension_class)) { $extension_class = '\\phpbb\\extension\\di\\extension_base'; } $this->container_extensions[] = new $extension_class($ext_name, $path); // Load extension autoloader $filename = $path . 'vendor/autoload.php'; if (file_exists($filename)) { $autoloaders .= "require('{$filename}');\n"; } } $configCache = new ConfigCache($this->get_autoload_filename(), false); $configCache->write($autoloaders); require $this->get_autoload_filename(); } else { // To load the extensions we need the database credentials. // Automatically disable the extensions if we don't have them. $this->use_extensions = false; } }