xref: /dokuwiki/_test/tests/Parsing/ParserMode/NotocTest.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\Notoc;
6*504c13e8SAndreas Gohr
7*504c13e8SAndreas Gohrclass NotocTest extends ParserTestBase
8*504c13e8SAndreas Gohr{
9*504c13e8SAndreas Gohr    function testNotoc()
10*504c13e8SAndreas Gohr    {
11*504c13e8SAndreas Gohr        $this->P->addMode('notoc', new Notoc());
12*504c13e8SAndreas Gohr        $this->P->parse('Foo ~~NOTOC~~ Bar');
13*504c13e8SAndreas Gohr        $calls = [
14*504c13e8SAndreas Gohr            ['document_start', []],
15*504c13e8SAndreas Gohr            ['p_open', []],
16*504c13e8SAndreas Gohr            ['cdata', ["\nFoo "]],
17*504c13e8SAndreas Gohr            ['notoc', []],
18*504c13e8SAndreas Gohr            ['cdata', [' Bar']],
19*504c13e8SAndreas Gohr            ['p_close', []],
20*504c13e8SAndreas Gohr            ['document_end', []],
21*504c13e8SAndreas Gohr        ];
22*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
23*504c13e8SAndreas Gohr    }
24*504c13e8SAndreas Gohr
25*504c13e8SAndreas Gohr    function testNotocNotInline()
26*504c13e8SAndreas Gohr    {
27*504c13e8SAndreas Gohr        $this->P->addMode('notoc', new Notoc());
28*504c13e8SAndreas Gohr        $this->P->parse('Foo ~~notoc~~ Bar');
29*504c13e8SAndreas Gohr        $calls = [
30*504c13e8SAndreas Gohr            ['document_start', []],
31*504c13e8SAndreas Gohr            ['p_open', []],
32*504c13e8SAndreas Gohr            ['cdata', ["\nFoo ~~notoc~~ Bar"]],
33*504c13e8SAndreas Gohr            ['p_close', []],
34*504c13e8SAndreas Gohr            ['document_end', []],
35*504c13e8SAndreas Gohr        ];
36*504c13e8SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
37*504c13e8SAndreas Gohr    }
38*504c13e8SAndreas Gohr}
39