/** * @dataProvider baseModuleDataProvider */ public function testMimickParserSetoptions($base_module) { $options = new ParserOptions(); $options->ca_info = __DIR__ . '/../../test-cacert.pem'; $options->baseModuleInterface = $base_module; $options->allow_all = true; $tags = (new Parser($options))->getAllowed(); // mimicking Parser::setOptions() here $this->baseModule = new $base_module(); foreach ($this->baseModule->getInfo()->modules as $module) { $this->module = new $module(); $this->assertInstanceOf(ModuleInterface::class, $this->module); foreach ($this->module->getTags()->tags as $tag) { $this->assertContains($tag, $tags); } } }
/** * Loads the parser modules * * @return void * @throws \chillerlan\bbcode\BBCodeException */ protected function loadModules() { $module_info = $this->baseModuleInterface->getInfo(); foreach ($module_info->modules as $module) { $this->moduleInterface = new $module(); $tagmap = $this->moduleInterface->getTags(); foreach ($tagmap->tags as $tag) { $this->tagmap[$tag] = $module; } $this->modules[$module] = $this->moduleInterface; $this->noparse_tags = array_merge($this->noparse_tags, $tagmap->noparse_tags); $this->singletags = array_merge($this->singletags, $tagmap->singletags); } $this->parserOptions->eol_token = $module_info->eol_token; $this->parserOptions->singletags = implode('|', $this->singletags); }