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