xref: /dokuwiki/_test/tests/Parsing/ParserMode/UnformattedTest.php (revision 504c13e8df88563c11b3720b317991bc38835a35)
1*504c13e8SAndreas Gohr<?php
2*504c13e8SAndreas Gohr
3*504c13e8SAndreas Gohrnamespace dokuwiki\test\Parsing\ParserMode;
4*504c13e8SAndreas Gohr
5*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Unformatted;
6*504c13e8SAndreas Gohr
7*504c13e8SAndreas Gohrclass UnformattedTest extends ParserTestBase
8*504c13e8SAndreas Gohr{
9*504c13e8SAndreas Gohr
10*504c13e8SAndreas Gohr    function testNowiki() {
11*504c13e8SAndreas Gohr        $this->P->addMode('unformatted',new Unformatted());
12*504c13e8SAndreas Gohr        $this->P->parse("Foo <nowiki>testing</nowiki> Bar");
13*504c13e8SAndreas Gohr        $calls = [
14*504c13e8SAndreas Gohr            ['document_start',[]],
15*504c13e8SAndreas Gohr            ['p_open',[]],
16*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
17*504c13e8SAndreas Gohr            ['unformatted',['testing']],
18*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
19*504c13e8SAndreas Gohr            ['p_close',[]],
20*504c13e8SAndreas Gohr            ['document_end',[]],
21*504c13e8SAndreas Gohr        ];
22*504c13e8SAndreas Gohr
23*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
24*504c13e8SAndreas Gohr
25*504c13e8SAndreas Gohr    }
26*504c13e8SAndreas Gohr
27*504c13e8SAndreas Gohr    function testDoublePercent() {
28*504c13e8SAndreas Gohr        $this->P->addMode('unformatted',new Unformatted());
29*504c13e8SAndreas Gohr        $this->P->parse("Foo %%testing%% Bar");
30*504c13e8SAndreas Gohr        $calls = [
31*504c13e8SAndreas Gohr            ['document_start',[]],
32*504c13e8SAndreas Gohr            ['p_open',[]],
33*504c13e8SAndreas Gohr            ['cdata',["\n".'Foo ']],
34*504c13e8SAndreas Gohr            ['unformatted',['testing']],
35*504c13e8SAndreas Gohr            ['cdata',[' Bar']],
36*504c13e8SAndreas Gohr            ['p_close',[]],
37*504c13e8SAndreas Gohr            ['document_end',[]],
38*504c13e8SAndreas Gohr        ];
39*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
40*504c13e8SAndreas Gohr    }
41*504c13e8SAndreas Gohr}
42