phpbb_template_template_test_case::setup_engine PHP Method

setup_engine() protected method

protected setup_engine ( array $new_config = [] )
$new_config array
    protected function setup_engine(array $new_config = array())
    {
        global $phpbb_root_path, $phpEx;
        $defaults = $this->config_defaults();
        $config = new \phpbb\config\config(array_merge($defaults, $new_config));
        $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
        $this->lang = $lang = new \phpbb\language\language($lang_loader);
        $user = new \phpbb\user($lang, '\\phpbb\\datetime');
        $this->user = $user;
        $filesystem = new \phpbb\filesystem\filesystem();
        $path_helper = new \phpbb\path_helper(new \phpbb\symfony_request(new phpbb_mock_request()), $filesystem, $this->getMock('\\phpbb\\request\\request'), $phpbb_root_path, $phpEx);
        $this->template_path = $this->test_path . '/templates';
        $container = new phpbb_mock_container_builder();
        $cache_path = $phpbb_root_path . 'cache/twig';
        $context = new \phpbb\template\context();
        $loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), '');
        $twig = new \phpbb\template\twig\environment($config, $filesystem, $path_helper, $cache_path, null, $loader, array('cache' => false, 'debug' => false, 'auto_reload' => true, 'autoescape' => false));
        $this->template = new phpbb\template\twig\twig($path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $this->user)));
        $twig->setLexer(new \phpbb\template\twig\lexer($twig));
        $this->template->set_custom_style('tests', $this->template_path);
    }