function testInlineParserConstructor() { $conf = new WRConfigTest(); $conf->defaultTextLineContainer = '\\WikiRenderer\\HtmlTextLine'; $conf->textLineContainers = array('\\WikiRenderer\\HtmlTextLine' => array('\\WikiRenderer\\Markup\\WR3Html\\Strong')); $wip = new WikiInlineParserTest($conf); $trueResult = '/(__)|(\\\\)/'; $this->assertEquals($trueResult, $wip->getSplitPattern()); $conf->textLineContainers = array('\\WikiRenderer\\HtmlTextLine' => array('\\WikiRenderer\\Markup\\WR3Html\\Strong', '\\WikiRenderer\\Markup\\WR3Html\\Em')); $conf->simpletags = array('%%%' => ''); $wip = new WikiInlineParserTest($conf); $trueResult = '/(__)|(\'\')|(%%%)|(\\\\)/'; $this->assertEquals($trueResult, $wip->getSplitPattern()); $conf->textLineContainers = array('\\WikiRenderer\\HtmlTextLine' => array('\\WikiRenderer\\Markup\\WR3Html\\Strong', '\\WikiRenderer\\Markup\\WR3Html\\Q')); $conf->simpletags = array('%%%' => ''); $wip = new WikiInlineParserTest($conf); $trueResult = '/(__)|(\\^\\^)|(\\|)|(%%%)|(\\\\)/'; $this->assertEquals($trueResult, $wip->getSplitPattern()); $conf->textLineContainers = array('\\WikiRenderer\\HtmlTextLine' => array('\\WikiRenderer\\Markup\\WR3Html\\Strong', '\\WikiRenderer\\Markup\\WR3Html\\Em', '\\WikiRenderer\\Markup\\WR3Html\\Code', '\\WikiRenderer\\Markup\\WR3Html\\Q', '\\WikiRenderer\\Markup\\WR3Html\\Cite', '\\WikiRenderer\\Markup\\WR3Html\\Acronym', '\\WikiRenderer\\Markup\\WR3Html\\Link', '\\WikiRenderer\\Markup\\WR3Html\\Image', '\\WikiRenderer\\Markup\\WR3Html\\Anchor')); $conf->simpletags = array('%%%' => '', ':-)' => ''); $wip = new WikiInlineParserTest($conf); $trueResult = '/(__)|(\'\')|(@@)|(\\^\\^)|(\\{\\{)|(\\}\\})|(\\?\\?)|(\\[\\[)|(\\]\\])|(\\(\\()|(\\)\\))|(~~)|(\\|)|(%%%)|(\\:\\-\\))|(\\\\)/'; $this->assertEquals($trueResult, $wip->getSplitPattern()); $test = array('__' => array('__', '__'), '\'\'' => array('\'\'', '\'\''), '@@' => array('@@', '@@'), '^^' => array('^^', '^^'), '{{' => array('{{', '}}'), '??' => array('??', '??'), '[[' => array('[[', ']]'), '((' => array('((', '))'), '~~' => array('~~', '~~')); foreach ($wip->getListTag() as $b => $t) { if ($this->assertTrue(isset($test[$b]), 'tag présent bizarre ' . $b)) { $this->assertEquals($test[$b][0], $t->beginTag); $this->assertEquals($test[$b][1], $t->endTag); } } }
function testInlineParserConstructor() { $conf = new WRConfigTest(); $conf->defaultTextLineContainer = 'WikiHtmlTextLine'; $conf->textLineContainers = array('WikiHtmlTextLine' => array('wr3xhtml_strong')); $wip = new WikiInlineParserTest($conf); $trueResult = '/(__)|(\\\\)/'; $this->assertEqualOrDiff($trueResult, $wip->getSplitPattern(), "erreur"); $conf->textLineContainers = array('WikiHtmlTextLine' => array('wr3xhtml_strong', 'wr3xhtml_em')); $conf->simpletags = array('%%%' => ''); $wip = new WikiInlineParserTest($conf); $trueResult = '/(__)|(\'\')|(%%%)|(\\\\)/'; $this->assertEqualOrDiff($trueResult, $wip->getSplitPattern(), "erreur"); $conf->textLineContainers = array('WikiHtmlTextLine' => array('wr3xhtml_strong', 'wr3xhtml_q')); $conf->simpletags = array('%%%' => ''); $wip = new WikiInlineParserTest($conf); $trueResult = '/(__)|(\\^\\^)|(\\|)|(%%%)|(\\\\)/'; $this->assertEqualOrDiff($trueResult, $wip->getSplitPattern(), "erreur"); $conf->textLineContainers = array('WikiHtmlTextLine' => array('wr3xhtml_strong', 'wr3xhtml_em', 'wr3xhtml_code', 'wr3xhtml_q', 'wr3xhtml_cite', 'wr3xhtml_acronym', 'wr3xhtml_link', 'wr3xhtml_image', 'wr3xhtml_anchor')); $conf->simpletags = array('%%%' => '', ':-)' => ''); $wip = new WikiInlineParserTest($conf); $trueResult = '/(__)|(\'\')|(@@)|(\\^\\^)|(\\{\\{)|(\\}\\})|(\\?\\?)|(\\[\\[)|(\\]\\])|(\\(\\()|(\\)\\))|(~~)|(\\|)|(%%%)|(\\:-\\))|(\\\\)/'; $this->assertEqualOrDiff($trueResult, $wip->getSplitPattern(), "erreur"); $test = array('__' => array('__', '__'), '\'\'' => array('\'\'', '\'\''), '@@' => array('@@', '@@'), '^^' => array('^^', '^^'), '{{' => array('{{', '}}'), '??' => array('??', '??'), '[[' => array('[[', ']]'), '((' => array('((', '))'), '~~' => array('~~', '~~')); foreach ($wip->getListTag() as $b => $t) { if ($this->assertTrue(isset($test[$b]), 'tag présent bizarre ' . $b)) { $this->assertEqual($test[$b][0], $t->beginTag); $this->assertEqual($test[$b][1], $t->endTag); } } }