public function init($content = null, $optionArray = null)
{
$this->_output = $content;
if (is_array($optionArray)) {
$this->_optionArray = array_merge($this->_optionArray, $optionArray);
}
/* process tags */
foreach ($this->_tagArray as $key => $value) {
$this->_tagArray[$key]['position'] = strpos($this->_output, '<' . $key . '>');
/* call related method */
if ($this->_tagArray[$key]['position'] > -1) {
$method = $value['method'];
$this->_output = $this->{$method}($this->_output);
}
}
}
/** * testParser * * @since 2.1.0 * * @param array $registry * @param string $input * @param string $route * @param string $expect * * @dataProvider providerParser */ public function testParser($registry = array(), $input = null, $route = null, $expect = null) { /* setup */ $this->_registry->init($registry); $parser = new Parser($this->_registry, $this->_language); $parser->init($input, $route, array('className' => array('break' => 'link-read-more', 'code' => 'box-code'))); /* actual */ $actual = $parser->getOutput(); /* compare */ $this->assertEquals($expect, $actual); }