[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 use dokuwiki\Parsing\ParserMode\File; 4 5 require_once 'parser.inc.php'; 6 7 class TestOfDoku_Parser_File extends TestOfDoku_Parser { 8 9 function setUp() : void { 10 parent::setUp(); 11 $this->P->addMode('file',new File()); 12 } 13 14 function testFile() { 15 $this->P->parse('Foo <file>Test</file> Bar'); 16 $calls = array ( 17 array('document_start',array()), 18 array('p_open',array()), 19 array('cdata',array("\n".'Foo ')), 20 array('p_close',array()), 21 array('file',array('Test',null,null)), 22 array('p_open',array()), 23 array('cdata',array(' Bar')), 24 array('p_close',array()), 25 array('document_end',array()), 26 ); 27 $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); 28 } 29 30 function testFileHighlightDownload() { 31 $this->P->parse('Foo <file txt test.txt>Test</file> Bar'); 32 $calls = array ( 33 array('document_start',array()), 34 array('p_open',array()), 35 array('cdata',array("\n".'Foo ')), 36 array('p_close',array()), 37 array('file',array('Test','txt','test.txt')), 38 array('p_open',array()), 39 array('cdata',array(' Bar')), 40 array('p_close',array()), 41 array('document_end',array()), 42 ); 43 $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); 44 } 45 46 function testFileToken() { 47 $this->P->parse('Foo <file2>Test</file2> Bar'); 48 $calls = array ( 49 array('document_start',array()), 50 array('p_open',array()), 51 array('cdata',array("\n".'Foo <file2>Test</file2> Bar')), 52 array('p_close',array()), 53 array('document_end',array()), 54 ); 55 $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); 56 } 57 58 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body