xref: /dokuwiki/_test/tests/Parsing/ParserMode/NocacheTest.php (revision 504c13e8df88563c11b3720b317991bc38835a35)
1<?php
2
3namespace dokuwiki\test\Parsing\ParserMode;
4
5use dokuwiki\Parsing\ParserMode\Nocache;
6
7class NocacheTest extends ParserTestBase
8{
9    function testNocache()
10    {
11        $this->P->addMode('nocache', new Nocache());
12        $this->P->parse('Foo ~~NOCACHE~~ Bar');
13        $calls = [
14            ['document_start', []],
15            ['p_open', []],
16            ['cdata', ["\nFoo "]],
17            ['nocache', []],
18            ['cdata', [' Bar']],
19            ['p_close', []],
20            ['document_end', []],
21        ];
22        $this->assertCalls($calls, $this->H->calls);
23    }
24
25    function testNocacheNotInline()
26    {
27        $this->P->addMode('nocache', new Nocache());
28        $this->P->parse('Foo ~~nocache~~ Bar');
29        $calls = [
30            ['document_start', []],
31            ['p_open', []],
32            ['cdata', ["\nFoo ~~nocache~~ Bar"]],
33            ['p_close', []],
34            ['document_end', []],
35        ];
36        $this->assertCalls($calls, $this->H->calls);
37    }
38}
39