xref: /dokuwiki/_test/tests/Parsing/ParserMode/FilelinkTest.php (revision 465aec673bd9c2018b4df5364f08c816a70f03a7)
1*465aec67SAndreas Gohr<?php
2*465aec67SAndreas Gohr
3*465aec67SAndreas Gohrnamespace dokuwiki\test\Parsing\ParserMode;
4*465aec67SAndreas Gohr
5*465aec67SAndreas Gohruse dokuwiki\Parsing\ParserMode\Filelink;
6*465aec67SAndreas Gohr
7*465aec67SAndreas Gohr/**
8*465aec67SAndreas Gohr * Tests for the {@see Filelink} parser mode: bare `file://...` URLs.
9*465aec67SAndreas Gohr *
10*465aec67SAndreas Gohr * @group parser_links
11*465aec67SAndreas Gohr */
12*465aec67SAndreas Gohrclass FilelinkTest extends ParserTestBase
13*465aec67SAndreas Gohr{
14*465aec67SAndreas Gohr    function testFileLink() {
15*465aec67SAndreas Gohr        $this->P->addMode('filelink', new FileLink());
16*465aec67SAndreas Gohr        $this->P->parse('Foo file://temp/file.txt Bar');
17*465aec67SAndreas Gohr        $calls = [
18*465aec67SAndreas Gohr            ['document_start', []],
19*465aec67SAndreas Gohr            ['p_open', []],
20*465aec67SAndreas Gohr            ['cdata', ["\n" . 'Foo ']],
21*465aec67SAndreas Gohr            ['filelink', ['file://temp/file.txt ', null]],
22*465aec67SAndreas Gohr            ['cdata', ['Bar']],
23*465aec67SAndreas Gohr            ['p_close', []],
24*465aec67SAndreas Gohr            ['document_end', []],
25*465aec67SAndreas Gohr        ];
26*465aec67SAndreas Gohr        $this->assertCalls($calls, $this->H->calls);
27*465aec67SAndreas Gohr    }
28*465aec67SAndreas Gohr}
29