xref: /dokuwiki/_test/tests/inc/parser/parser.inc.php (revision 8b1b81be965547272e7d20de20c2783fa59178cd)
1f8369d7dSTobias Sarnowski<?php
2f8369d7dSTobias Sarnowski
3f8369d7dSTobias Sarnowskirequire_once DOKU_INC . 'inc/parser/parser.php';
4f8369d7dSTobias Sarnowskirequire_once DOKU_INC . 'inc/parser/handler.php';
5*8b1b81beSAndreas Gohrif (!defined('DOKU_PARSER_EOL')) define('DOKU_PARSER_EOL', "\n");   // add this to make handling test cases simpler
6f8369d7dSTobias Sarnowski
736340418SAndreas Gohrabstract class TestOfDoku_Parser extends DokuWikiTest {
8f8369d7dSTobias Sarnowski
9347fb6e3SAndreas Gohr    /** @var  Doku_Parser */
10347fb6e3SAndreas Gohr    protected $P;
11347fb6e3SAndreas Gohr    /** @var  Doku_Handler */
12347fb6e3SAndreas Gohr    protected $H;
13f8369d7dSTobias Sarnowski
14ff576d93SDominik Eckelmann    function setUp() {
15ff576d93SDominik Eckelmann        parent::setUp();
16f8369d7dSTobias Sarnowski        $this->H = new Doku_Handler();
1747f73ecfSAndreas Gohr        $this->P = new Doku_Parser($this->H);
18f8369d7dSTobias Sarnowski    }
19f8369d7dSTobias Sarnowski
20f8369d7dSTobias Sarnowski    function tearDown() {
21f8369d7dSTobias Sarnowski        unset($this->P);
22f8369d7dSTobias Sarnowski        unset($this->H);
23f8369d7dSTobias Sarnowski    }
24f8369d7dSTobias Sarnowski}
25f8369d7dSTobias Sarnowski
26f8369d7dSTobias Sarnowskifunction stripByteIndex($call) {
27f8369d7dSTobias Sarnowski    unset($call[2]);
28f8369d7dSTobias Sarnowski    if ($call[0] == "nest") {
29f8369d7dSTobias Sarnowski      $call[1][0] = array_map('stripByteIndex',$call[1][0]);
30f8369d7dSTobias Sarnowski    }
31f8369d7dSTobias Sarnowski    return $call;
32f8369d7dSTobias Sarnowski}
33