xref: /dokuwiki/_test/tests/inc/parser/parser_file.test.php (revision f2bbf30b71b15efa7a918944b4ffc74f8b1747a9)
1*f2bbf30bSGuy Brand<?php
2*f2bbf30bSGuy Brandrequire_once 'parser.inc.php';
3*f2bbf30bSGuy Brand
4*f2bbf30bSGuy Brandclass TestOfDoku_Parser_File extends TestOfDoku_Parser {
5*f2bbf30bSGuy Brand
6*f2bbf30bSGuy Brand    function setUp() {
7*f2bbf30bSGuy Brand        parent::setUp();
8*f2bbf30bSGuy Brand        $this->P->addMode('file',new Doku_Parser_Mode_File());
9*f2bbf30bSGuy Brand    }
10*f2bbf30bSGuy Brand
11*f2bbf30bSGuy Brand    function testFile() {
12*f2bbf30bSGuy Brand        $this->P->parse('Foo <file>Test</file> Bar');
13*f2bbf30bSGuy Brand        $calls = array (
14*f2bbf30bSGuy Brand            array('document_start',array()),
15*f2bbf30bSGuy Brand            array('p_open',array()),
16*f2bbf30bSGuy Brand            array('cdata',array("\n".'Foo ')),
17*f2bbf30bSGuy Brand            array('p_close',array()),
18*f2bbf30bSGuy Brand            array('file',array('Test',null,null)),
19*f2bbf30bSGuy Brand            array('p_open',array()),
20*f2bbf30bSGuy Brand            array('cdata',array(' Bar')),
21*f2bbf30bSGuy Brand            array('p_close',array()),
22*f2bbf30bSGuy Brand            array('document_end',array()),
23*f2bbf30bSGuy Brand        );
24*f2bbf30bSGuy Brand        $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
25*f2bbf30bSGuy Brand    }
26*f2bbf30bSGuy Brand
27*f2bbf30bSGuy Brand}
28*f2bbf30bSGuy Brand
29