diff options
Diffstat (limited to '_test/tests/inc/parser')
-rw-r--r-- | _test/tests/inc/parser/parser_code.test.php | 5 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_eol.test.php | 18 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_file.test.php | 5 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_footnote.test.php | 42 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_headers.test.php | 36 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_i18n.test.php | 19 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_links.test.php | 111 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_lists.test.php | 62 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_preformatted.test.php | 40 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_quote.test.php | 14 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_quotes.test.php | 37 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_replacements.test.php | 50 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_table.test.php | 64 | ||||
-rw-r--r-- | _test/tests/inc/parser/parser_unformatted.test.php | 7 |
14 files changed, 298 insertions, 212 deletions
diff --git a/_test/tests/inc/parser/parser_code.test.php b/_test/tests/inc/parser/parser_code.test.php index df8225f4e..1c79462c3 100644 --- a/_test/tests/inc/parser/parser_code.test.php +++ b/_test/tests/inc/parser/parser_code.test.php @@ -1,4 +1,7 @@ <?php + +use dokuwiki\ParserMode\Code; + require_once 'parser.inc.php'; /** @@ -10,7 +13,7 @@ class TestOfDoku_Parser_Code extends TestOfDoku_Parser { function setUp() { parent::setUp(); - $this->P->addMode('code',new Doku_Parser_Mode_Code()); + $this->P->addMode('code',new Code()); } function testCode() { diff --git a/_test/tests/inc/parser/parser_eol.test.php b/_test/tests/inc/parser/parser_eol.test.php index 6264f8b55..3ae96ef62 100644 --- a/_test/tests/inc/parser/parser_eol.test.php +++ b/_test/tests/inc/parser/parser_eol.test.php @@ -1,10 +1,14 @@ <?php + +use dokuwiki\ParserMode\Eol; +use dokuwiki\ParserMode\Linebreak; + require_once 'parser.inc.php'; class TestOfDoku_Parser_Eol extends TestOfDoku_Parser { function testEol() { - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('eol',new Eol()); $this->P->parse("Foo\nBar"); $calls = array ( array('document_start',array()), @@ -17,7 +21,7 @@ class TestOfDoku_Parser_Eol extends TestOfDoku_Parser { } function testEolMultiple() { - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('eol',new Eol()); $this->P->parse("Foo\n\nbar\nFoo"); $calls = array ( array('document_start',array()), @@ -33,7 +37,7 @@ class TestOfDoku_Parser_Eol extends TestOfDoku_Parser { } function testWinEol() { - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('eol',new Eol()); $this->P->parse("Foo\r\nBar"); $calls = array ( array('document_start',array()), @@ -46,7 +50,7 @@ class TestOfDoku_Parser_Eol extends TestOfDoku_Parser { } function testLinebreak() { - $this->P->addMode('linebreak',new Doku_Parser_Mode_Linebreak()); + $this->P->addMode('linebreak',new Linebreak()); $this->P->parse('Foo\\\\ Bar'); $calls = array ( array('document_start',array()), @@ -61,8 +65,8 @@ class TestOfDoku_Parser_Eol extends TestOfDoku_Parser { } function testLinebreakPlusEol() { - $this->P->addMode('linebreak',new Doku_Parser_Mode_Linebreak()); - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('linebreak',new Linebreak()); + $this->P->addMode('eol',new Eol()); $this->P->parse('Foo\\\\'."\n\n".'Bar'); $calls = array ( @@ -80,7 +84,7 @@ class TestOfDoku_Parser_Eol extends TestOfDoku_Parser { } function testLinebreakInvalid() { - $this->P->addMode('linebreak',new Doku_Parser_Mode_Linebreak()); + $this->P->addMode('linebreak',new Linebreak()); $this->P->parse('Foo\\\\Bar'); $calls = array ( array('document_start',array()), diff --git a/_test/tests/inc/parser/parser_file.test.php b/_test/tests/inc/parser/parser_file.test.php index 39bda8a58..8c8caac85 100644 --- a/_test/tests/inc/parser/parser_file.test.php +++ b/_test/tests/inc/parser/parser_file.test.php @@ -1,11 +1,14 @@ <?php + +use dokuwiki\ParserMode\File; + require_once 'parser.inc.php'; class TestOfDoku_Parser_File extends TestOfDoku_Parser { function setUp() { parent::setUp(); - $this->P->addMode('file',new Doku_Parser_Mode_File()); + $this->P->addMode('file',new File()); } function testFile() { diff --git a/_test/tests/inc/parser/parser_footnote.test.php b/_test/tests/inc/parser/parser_footnote.test.php index 2457fb031..74f7c64f3 100644 --- a/_test/tests/inc/parser/parser_footnote.test.php +++ b/_test/tests/inc/parser/parser_footnote.test.php @@ -1,11 +1,23 @@ <?php + +use dokuwiki\ParserMode\Code; +use dokuwiki\ParserMode\Eol; +use dokuwiki\ParserMode\Footnote; +use dokuwiki\ParserMode\Formatting; +use dokuwiki\ParserMode\Hr; +use dokuwiki\ParserMode\Listblock; +use dokuwiki\ParserMode\Preformatted; +use dokuwiki\ParserMode\Quote; +use dokuwiki\ParserMode\Table; +use dokuwiki\ParserMode\Unformatted; + require_once 'parser.inc.php'; class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { function setUp() { parent::setUp(); - $this->P->addMode('footnote',new Doku_Parser_Mode_Footnote()); + $this->P->addMode('footnote',new Footnote()); } function testFootnote() { @@ -39,7 +51,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnoteLinefeed() { - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('eol',new Eol()); $this->P->parse("Foo (( testing\ntesting )) Bar"); $calls = array ( array('document_start',array()), @@ -76,7 +88,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnoteEol() { - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('eol',new Eol()); $this->P->parse("Foo \nX(( test\ning ))Y\n Bar"); $calls = array ( array('document_start',array()), @@ -95,7 +107,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnoteStrong() { - $this->P->addMode('strong',new Doku_Parser_Mode_Formatting('strong')); + $this->P->addMode('strong',new Formatting('strong')); $this->P->parse('Foo (( **testing** )) Bar'); $calls = array ( array('document_start',array()), @@ -118,7 +130,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnoteHr() { - $this->P->addMode('hr',new Doku_Parser_Mode_HR()); + $this->P->addMode('hr',new Hr()); $this->P->parse("Foo (( \n ---- \n )) Bar"); $calls = array ( array('document_start',array()), @@ -139,7 +151,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnoteCode() { - $this->P->addMode('code',new Doku_Parser_Mode_Code()); + $this->P->addMode('code',new Code()); $this->P->parse("Foo (( <code>Test</code> )) Bar"); $calls = array ( array('document_start',array()), @@ -160,7 +172,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnotePreformatted() { - $this->P->addMode('preformatted',new Doku_Parser_Mode_Preformatted()); + $this->P->addMode('preformatted',new Preformatted()); $this->P->parse("Foo (( \n Test\n )) Bar"); $calls = array ( array('document_start',array()), @@ -181,8 +193,8 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnotePreformattedEol() { - $this->P->addMode('preformatted',new Doku_Parser_Mode_Preformatted()); - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('preformatted',new Preformatted()); + $this->P->addMode('eol',new Eol()); $this->P->parse("Foo (( \n Test\n )) Bar"); $calls = array ( array('document_start',array()), @@ -204,7 +216,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnoteUnformatted() { - $this->P->addMode('unformatted',new Doku_Parser_Mode_Unformatted()); + $this->P->addMode('unformatted',new Unformatted()); $this->P->parse("Foo (( <nowiki>Test</nowiki> )) Bar"); $calls = array ( array('document_start',array()), @@ -225,7 +237,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnoteNotHeader() { - $this->P->addMode('unformatted',new Doku_Parser_Mode_Unformatted()); + $this->P->addMode('unformatted',new Unformatted()); $this->P->parse("Foo (( \n====Test====\n )) Bar"); $calls = array ( array('document_start',array()), @@ -244,7 +256,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnoteTable() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse("Foo (( | Row 0 Col 1 | Row 0 Col 2 | Row 0 Col 3 | | Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | @@ -290,7 +302,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnoteList() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); + $this->P->addMode('listblock',new ListBlock()); $this->P->parse("Foo (( *A * B @@ -332,7 +344,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnoteQuote() { - $this->P->addMode('quote',new Doku_Parser_Mode_Quote()); + $this->P->addMode('quote',new Quote()); $this->P->parse("Foo (( > def >>ghi @@ -361,7 +373,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { } function testFootnoteNesting() { - $this->P->addMode('strong',new Doku_Parser_Mode_Formatting('strong')); + $this->P->addMode('strong',new Formatting('strong')); $this->P->parse("(( a ** (( b )) ** c ))"); $calls = array( diff --git a/_test/tests/inc/parser/parser_headers.test.php b/_test/tests/inc/parser/parser_headers.test.php index a1bf7d2ba..5c5936a82 100644 --- a/_test/tests/inc/parser/parser_headers.test.php +++ b/_test/tests/inc/parser/parser_headers.test.php @@ -1,10 +1,14 @@ <?php + +use dokuwiki\ParserMode\Eol; +use dokuwiki\ParserMode\Header; + require_once 'parser.inc.php'; class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { function testHeader1() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n ====== Header ====== \n def"); $calls = array ( array('document_start',array()), @@ -23,7 +27,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } function testHeader2() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n ===== Header ===== \n def"); $calls = array ( array('document_start',array()), @@ -42,7 +46,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } function testHeader3() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n ==== Header ==== \n def"); $calls = array ( array('document_start',array()), @@ -61,7 +65,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } function testHeader4() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n === Header === \n def"); $calls = array ( array('document_start',array()), @@ -80,7 +84,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } function testHeader5() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n == Header == \n def"); $calls = array ( array('document_start',array()), @@ -99,7 +103,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } function testHeader2UnevenSmaller() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n ===== Header == \n def"); $calls = array ( array('document_start',array()), @@ -118,7 +122,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } function testHeader2UnevenBigger() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n ===== Header =========== \n def"); $calls = array ( array('document_start',array()), @@ -137,7 +141,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } function testHeaderLarge() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n ======= Header ======= \n def"); $calls = array ( array('document_start',array()), @@ -156,7 +160,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } function testHeaderSmall() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n= Header =\n def"); $calls = array ( array('document_start',array()), @@ -170,7 +174,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { function testHeader1Mixed() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n====== == Header == ======\n def"); $calls = array ( array('document_start',array()), @@ -189,7 +193,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } function testHeader5Mixed() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n== ====== Header ====== ==\n def"); $calls = array ( array('document_start',array()), @@ -208,7 +212,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } function testHeaderMultiline() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n== ====== Header\n ====== ==\n def"); $calls = array ( array('document_start',array()), @@ -227,14 +231,14 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } # function testNoToc() { -# $this->P->addMode('notoc',new Doku_Parser_Mode_NoToc()); +# $this->P->addMode('notoc',new NoToc()); # $this->P->parse('abc ~~NOTOC~~ def'); # $this->assertFalse($this->H->meta['toc']); # } function testHeader1Eol() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('header',new Header()); + $this->P->addMode('eol',new Eol()); $this->P->parse("abc \n ====== Header ====== \n def"); $calls = array ( array('document_start',array()), @@ -254,7 +258,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser { } function testHeaderMulti2() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("abc \n ====== Header ====== \n def abc \n ===== Header2 ===== \n def"); $calls = array ( array('document_start',array()), diff --git a/_test/tests/inc/parser/parser_i18n.test.php b/_test/tests/inc/parser/parser_i18n.test.php index 096f2e227..b9fb64c4f 100644 --- a/_test/tests/inc/parser/parser_i18n.test.php +++ b/_test/tests/inc/parser/parser_i18n.test.php @@ -1,4 +1,11 @@ <?php + +use dokuwiki\ParserMode\Acronym; +use dokuwiki\ParserMode\Formatting; +use dokuwiki\ParserMode\Header; +use dokuwiki\ParserMode\Internallink; +use dokuwiki\ParserMode\Table; + require_once 'parser.inc.php'; class TestOfDoku_Parser_i18n extends TestOfDoku_Parser { @@ -9,7 +16,7 @@ class TestOfDoku_Parser_i18n extends TestOfDoku_Parser { 'subscript', 'superscript', 'deleted', ); foreach ( $formats as $format ) { - $this->P->addMode($format,new Doku_Parser_Mode_Formatting($format)); + $this->P->addMode($format,new Formatting($format)); } $this->P->parse("I**ñ**t__ë__r//n//â<sup>t</sup>i<sub>ô</sub>n''à''liz<del>æ</del>tiøn"); $calls = array ( @@ -51,7 +58,7 @@ class TestOfDoku_Parser_i18n extends TestOfDoku_Parser { } function testHeader() { - $this->P->addMode('header',new Doku_Parser_Mode_Header()); + $this->P->addMode('header',new Header()); $this->P->parse("Foo\n ==== Iñtërnâtiônàlizætiøn ==== \n Bar"); $calls = array ( array('document_start',array()), @@ -70,7 +77,7 @@ class TestOfDoku_Parser_i18n extends TestOfDoku_Parser { } function testTable() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc | Row 0 Col 1 | Iñtërnâtiônàlizætiøn | Row 0 Col 3 | @@ -115,7 +122,7 @@ def'); function testAcronym() { $t = array('Iñtërnâtiônàlizætiøn'); - $this->P->addMode('acronym',new Doku_Parser_Mode_Acronym($t)); + $this->P->addMode('acronym',new Acronym($t)); $this->P->parse("Foo Iñtërnâtiônàlizætiøn Bar"); $calls = array ( array('document_start',array()), @@ -130,7 +137,7 @@ def'); } function testInterwiki() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new InternalLink()); $this->P->parse("Foo [[wp>Iñtërnâtiônàlizætiøn|Iñtërnâtiônàlizætiøn]] Bar"); $calls = array ( array('document_start',array()), @@ -145,7 +152,7 @@ def'); } function testInternalLink() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new InternalLink()); $this->P->parse("Foo [[x:Iñtërnâtiônàlizætiøn:y:foo_bar:z|Iñtërnâtiônàlizætiøn]] Bar"); $calls = array ( array('document_start',array()), diff --git a/_test/tests/inc/parser/parser_links.test.php b/_test/tests/inc/parser/parser_links.test.php index ee001e73a..40d78da6b 100644 --- a/_test/tests/inc/parser/parser_links.test.php +++ b/_test/tests/inc/parser/parser_links.test.php @@ -1,4 +1,13 @@ <?php + +use dokuwiki\ParserMode\Camelcaselink; +use dokuwiki\ParserMode\Emaillink; +use dokuwiki\ParserMode\Externallink; +use dokuwiki\ParserMode\Filelink; +use dokuwiki\ParserMode\Internallink; +use dokuwiki\ParserMode\Media; +use dokuwiki\ParserMode\Windowssharelink; + require_once 'parser.inc.php'; /** @@ -9,7 +18,7 @@ require_once 'parser.inc.php'; class TestOfDoku_Parser_Links extends TestOfDoku_Parser { function testExternalLinkSimple() { - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('externallink',new Externallink()); $this->P->parse("Foo http://www.google.com Bar"); $calls = array ( array('document_start',array()), @@ -24,7 +33,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalLinkCase() { - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('externallink',new Externallink()); $this->P->parse("Foo HTTP://WWW.GOOGLE.COM Bar"); $calls = array ( array('document_start',array()), @@ -39,7 +48,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalIPv4() { - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('externallink',new Externallink()); $this->P->parse("Foo http://123.123.3.21/foo Bar"); $calls = array ( array('document_start',array()), @@ -54,7 +63,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalIPv6() { - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('externallink',new Externallink()); $this->P->parse("Foo http://[3ffe:2a00:100:7031::1]/foo Bar"); $calls = array ( array('document_start',array()), @@ -96,8 +105,8 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { $name = $title; } $this->setup(); - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('internallink',new Internallink()); + $this->P->addMode('externallink',new Externallink()); $this->P->parse("Foo $source Bar"); $calls = array ( array('document_start',array()), @@ -117,7 +126,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalLinkJavascript() { - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('externallink',new Externallink()); $this->P->parse("Foo javascript:alert('XSS'); Bar"); $calls = array ( array('document_start',array()), @@ -130,7 +139,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalWWWLink() { - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('externallink',new Externallink()); $this->P->parse("Foo www.google.com Bar"); $calls = array ( array('document_start',array()), @@ -145,7 +154,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalWWWLinkInPath() { - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('externallink',new Externallink()); // See issue #936. Should NOT generate a link! $this->P->parse("Foo /home/subdir/www/www.something.de/somedir/ Bar"); $calls = array ( @@ -159,7 +168,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalWWWLinkFollowingPath() { - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('externallink',new Externallink()); $this->P->parse("Foo /home/subdir/www/ www.something.de/somedir/ Bar"); $calls = array ( array('document_start',array()), @@ -174,7 +183,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalFTPLink() { - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('externallink',new Externallink()); $this->P->parse("Foo ftp.sunsite.com Bar"); $calls = array ( array('document_start',array()), @@ -189,7 +198,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalFTPLinkInPath() { - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('externallink',new Externallink()); // See issue #936. Should NOT generate a link! $this->P->parse("Foo /home/subdir/www/ftp.something.de/somedir/ Bar"); $calls = array ( @@ -203,7 +212,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalFTPLinkFollowingPath() { - $this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink()); + $this->P->addMode('externallink',new Externallink()); $this->P->parse("Foo /home/subdir/www/ ftp.something.de/somedir/ Bar"); $calls = array ( array('document_start',array()), @@ -218,7 +227,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testEmail() { - $this->P->addMode('emaillink',new Doku_Parser_Mode_Emaillink()); + $this->P->addMode('emaillink',new Emaillink()); $this->P->parse("Foo <bugs@php.net> Bar"); $calls = array ( array('document_start',array()), @@ -233,7 +242,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testEmailRFC2822() { - $this->P->addMode('emaillink',new Doku_Parser_Mode_Emaillink()); + $this->P->addMode('emaillink',new Emaillink()); $this->P->parse("Foo <~fix+bug's.for/ev{e}r@php.net> Bar"); $calls = array ( array('document_start',array()), @@ -248,7 +257,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testEmailCase() { - $this->P->addMode('emaillink',new Doku_Parser_Mode_Emaillink()); + $this->P->addMode('emaillink',new Emaillink()); $this->P->parse("Foo <bugs@pHp.net> Bar"); $calls = array ( array('document_start',array()), @@ -264,7 +273,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { function testInternalLinkOneChar() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[l]] Bar"); $calls = array ( array('document_start',array()), @@ -279,7 +288,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testInternalLinkNoChar() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[]] Bar"); $calls = array ( array('document_start',array()), @@ -294,7 +303,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testInternalLinkNamespaceNoTitle() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[foo:bar]] Bar"); $calls = array ( array('document_start',array()), @@ -309,7 +318,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testInternalLinkNamespace() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[x:1:y:foo_bar:z|Test]] Bar"); $calls = array ( array('document_start',array()), @@ -324,7 +333,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testInternalLinkSectionRef() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[wiki:syntax#internal|Syntax]] Bar"); $calls = array ( array('document_start',array()), @@ -339,7 +348,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testInternalLinkCodeFollows() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[wiki:internal:link|Test]] Bar <code>command [arg1 [arg2 [arg3]]]</code>"); $calls = array ( array('document_start',array()), @@ -354,7 +363,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testInternalLinkCodeFollows2() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[wiki:internal:link|[Square brackets in title] Test]] Bar <code>command [arg1 [arg2 [arg3]]]</code>"); $calls = array ( array('document_start',array()), @@ -369,7 +378,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalInInternalLink() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[http://www.google.com|Google]] Bar"); $calls = array ( array('document_start',array()), @@ -384,7 +393,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalInInternalLink2() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[http://www.google.com?test[]=squarebracketsinurl|Google]] Bar"); $calls = array ( array('document_start',array()), @@ -399,7 +408,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testExternalInInternalLink2CodeFollows() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[http://www.google.com?test[]=squarebracketsinurl|Google]] Bar <code>command [arg1 [arg2 [arg3]]]</code>"); $calls = array ( array('document_start',array()), @@ -414,7 +423,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testTwoInternalLinks() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[foo:bar|one]] and [[bar:foo|two]] Bar"); $calls = array ( array('document_start',array()), @@ -432,7 +441,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { function testInterwikiLink() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[iw>somepage|Some Page]] Bar"); $calls = array ( array('document_start',array()), @@ -447,7 +456,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testInterwikiLinkCase() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[IW>somepage|Some Page]] Bar"); $calls = array ( array('document_start',array()), @@ -462,7 +471,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testInterwikiPedia() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[wp>Callback_(computer_science)|callbacks]] Bar"); $calls = array ( array('document_start',array()), @@ -477,7 +486,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testCamelCase() { - $this->P->addMode('camelcaselink',new Doku_Parser_Mode_CamelCaseLink()); + $this->P->addMode('camelcaselink',new Camelcaselink()); $this->P->parse("Foo FooBar Bar"); $calls = array ( array('document_start',array()), @@ -492,7 +501,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testFileLink() { - $this->P->addMode('filelink',new Doku_Parser_Mode_FileLink()); + $this->P->addMode('filelink',new FileLink()); $this->P->parse('Foo file://temp/file.txt Bar'); $calls = array ( array('document_start',array()), @@ -507,7 +516,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testFileLinkInternal() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse('Foo [[file://temp/file.txt|Some File]] Bar'); $calls = array ( array('document_start',array()), @@ -522,7 +531,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testWindowsShareLink() { - $this->P->addMode('windowssharelink',new Doku_Parser_Mode_WindowsShareLink()); + $this->P->addMode('windowssharelink',new Windowssharelink()); $this->P->parse('Foo \\\server\share Bar'); $calls = array ( array('document_start',array()), @@ -537,7 +546,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testWindowsShareLinkHyphen() { - $this->P->addMode('windowssharelink',new Doku_Parser_Mode_WindowsShareLink()); + $this->P->addMode('windowssharelink',new Windowssharelink()); $this->P->parse('Foo \\\server\share-hyphen Bar'); $calls = array ( array('document_start',array()), @@ -552,7 +561,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testWindowsShareLinkInternal() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse('Foo [[\\\server\share|My Documents]] Bar'); $calls = array ( array('document_start',array()), @@ -567,7 +576,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaInternal() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{img.gif}} Bar'); $calls = array ( array('document_start',array()), @@ -582,7 +591,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaInternalLinkOnly() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{img.gif?linkonly}} Bar'); $calls = array ( array('document_start',array()), @@ -597,7 +606,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaNotImage() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{foo.txt?10x10|Some File}} Bar'); $calls = array ( array('document_start',array()), @@ -612,7 +621,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaInternalLAlign() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{img.gif }} Bar'); $calls = array ( array('document_start',array()), @@ -627,7 +636,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaInternalRAlign() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{ img.gif}} Bar'); $calls = array ( array('document_start',array()), @@ -642,7 +651,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaInternalCenter() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{ img.gif }} Bar'); $calls = array ( array('document_start',array()), @@ -657,7 +666,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaInternalParams() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{img.gif?50x100nocache}} Bar'); $calls = array ( array('document_start',array()), @@ -672,7 +681,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaInternalTitle() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{img.gif?50x100|Some Image}} Bar'); $calls = array ( array('document_start',array()), @@ -687,7 +696,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaExternal() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{http://www.google.com/img.gif}} Bar'); $calls = array ( array('document_start',array()), @@ -702,7 +711,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaExternalParams() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{http://www.google.com/img.gif?50x100nocache}} Bar'); $calls = array ( array('document_start',array()), @@ -717,7 +726,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaExternalTitle() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{http://www.google.com/img.gif?50x100|Some Image}} Bar'); $calls = array ( array('document_start',array()), @@ -733,7 +742,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaInInternalLink() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[x:1:y:foo_bar:z|{{img.gif?10x20nocache|Some Image}}]] Bar"); $image = array( @@ -760,7 +769,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaNoImageInInternalLink() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[x:1:y:foo_bar:z|{{foo.txt?10x20nocache|Some Image}}]] Bar"); $image = array( @@ -787,7 +796,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testMediaInEmailLink() { - $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); + $this->P->addMode('internallink',new Internallink()); $this->P->parse("Foo [[foo@example.com|{{img.gif?10x20nocache|Some Image}}]] Bar"); $image = array( @@ -814,7 +823,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { } function testNestedMedia() { - $this->P->addMode('media',new Doku_Parser_Mode_Media()); + $this->P->addMode('media',new Media()); $this->P->parse('Foo {{img.gif|{{foo.gif|{{bar.gif|Bar}}}}}} Bar'); $calls = array ( array('document_start',array()), diff --git a/_test/tests/inc/parser/parser_lists.test.php b/_test/tests/inc/parser/parser_lists.test.php index 6acaff637..ee0493c9f 100644 --- a/_test/tests/inc/parser/parser_lists.test.php +++ b/_test/tests/inc/parser/parser_lists.test.php @@ -1,10 +1,18 @@ <?php + +use dokuwiki\ParserMode\Eol; +use dokuwiki\ParserMode\Footnote; +use dokuwiki\ParserMode\Formatting; +use dokuwiki\ParserMode\Linebreak; +use dokuwiki\ParserMode\Listblock; +use dokuwiki\ParserMode\Unformatted; + require_once 'parser.inc.php'; class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { function testUnorderedList() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); + $this->P->addMode('listblock',new Listblock()); $this->P->parse(' *A * B @@ -37,7 +45,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { } function testOrderedList() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); + $this->P->addMode('listblock',new Listblock()); $this->P->parse(' -A - B @@ -71,7 +79,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { function testMixedList() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); + $this->P->addMode('listblock',new Listblock()); $this->P->parse(' -A * B @@ -102,9 +110,9 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { ); $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testUnorderedListWinEOL() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); + $this->P->addMode('listblock',new Listblock()); $this->P->parse("\r\n *A\r\n * B\r\n * C\r\n"); $calls = array ( array('document_start',array()), @@ -131,9 +139,9 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { ); $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testOrderedListWinEOL() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); + $this->P->addMode('listblock',new Listblock()); $this->P->parse("\r\n -A\r\n - B\r\n - C\r\n"); $calls = array ( array('document_start',array()), @@ -160,9 +168,9 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { ); $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testNotAList() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); + $this->P->addMode('listblock',new Listblock()); $this->P->parse("Foo -bar *foo Bar"); $calls = array ( array('document_start',array()), @@ -173,10 +181,10 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { ); $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testUnorderedListParagraph() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('listblock',new Listblock()); + $this->P->addMode('eol',new Eol()); $this->P->parse('Foo *A * B @@ -213,12 +221,12 @@ Bar'); ); $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); } - + // This is really a failing test - formatting able to spread across list items // Problem is fixing it would mean a major rewrite of lists function testUnorderedListStrong() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); - $this->P->addMode('strong',new Doku_Parser_Mode_Formatting('strong')); + $this->P->addMode('listblock',new Listblock()); + $this->P->addMode('strong',new Formatting('strong')); $this->P->parse(' ***A** *** B @@ -248,12 +256,12 @@ Bar'); ); $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); } - + // This is really a failing test - unformatted able to spread across list items // Problem is fixing it would mean a major rewrite of lists function testUnorderedListUnformatted() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); - $this->P->addMode('unformatted',new Doku_Parser_Mode_Unformatted()); + $this->P->addMode('listblock',new Listblock()); + $this->P->addMode('unformatted',new Unformatted()); $this->P->parse(' *%%A%% *%% B @@ -279,10 +287,10 @@ Bar'); ); $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testUnorderedListLinebreak() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); - $this->P->addMode('linebreak',new Doku_Parser_Mode_Linebreak()); + $this->P->addMode('listblock',new Listblock()); + $this->P->addMode('linebreak',new Linebreak()); $this->P->parse(' *A\\\\ D * B @@ -315,10 +323,10 @@ Bar'); ); $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testUnorderedListLinebreak2() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); - $this->P->addMode('linebreak',new Doku_Parser_Mode_Linebreak()); + $this->P->addMode('listblock',new Listblock()); + $this->P->addMode('linebreak',new Linebreak()); $this->P->parse(' *A\\\\ * B @@ -342,10 +350,10 @@ Bar'); ); $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); } - + function testUnorderedListFootnote() { - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); - $this->P->addMode('footnote',new Doku_Parser_Mode_Footnote()); + $this->P->addMode('listblock',new Listblock()); + $this->P->addMode('footnote',new Footnote()); $this->P->parse(' *((A)) *(( B diff --git a/_test/tests/inc/parser/parser_preformatted.test.php b/_test/tests/inc/parser/parser_preformatted.test.php index f7a01a7e5..f1eee24a1 100644 --- a/_test/tests/inc/parser/parser_preformatted.test.php +++ b/_test/tests/inc/parser/parser_preformatted.test.php @@ -1,10 +1,20 @@ <?php + +use dokuwiki\ParserMode\Code; +use dokuwiki\ParserMode\Eol; +use dokuwiki\ParserMode\File; +use dokuwiki\ParserMode\Header; +use dokuwiki\ParserMode\Html; +use dokuwiki\ParserMode\Listblock; +use dokuwiki\ParserMode\Php; +use dokuwiki\ParserMode\Preformatted; + require_once 'parser.inc.php'; class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { function testFile() { - $this->P->addMode('file',new Doku_Parser_Mode_File()); + $this->P->addMode('file',new File()); $this->P->parse('Foo <file>testing</file> Bar'); $calls = array ( array('document_start',array()), @@ -22,7 +32,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { } function testCode() { - $this->P->addMode('code',new Doku_Parser_Mode_Code()); + $this->P->addMode('code',new Code()); $this->P->parse('Foo <code>testing</code> Bar'); $calls = array ( array('document_start',array()), @@ -39,7 +49,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { } function testCodeWhitespace() { - $this->P->addMode('code',new Doku_Parser_Mode_Code()); + $this->P->addMode('code',new Code()); $this->P->parse("Foo <code \n>testing</code> Bar"); $calls = array ( array('document_start',array()), @@ -56,7 +66,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { } function testCodeLang() { - $this->P->addMode('code',new Doku_Parser_Mode_Code()); + $this->P->addMode('code',new Code()); $this->P->parse("Foo <code php>testing</code> Bar"); $calls = array ( array('document_start',array()), @@ -73,7 +83,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { } function testPreformatted() { - $this->P->addMode('preformatted',new Doku_Parser_Mode_Preformatted()); + $this->P->addMode('preformatted',new Preformatted()); $this->P->parse("F oo\n x \n y \nBar\n"); $calls = array ( array('document_start',array()), @@ -90,7 +100,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { } function testPreformattedWinEOL() { - $this->P->addMode('preformatted',new Doku_Parser_Mode_Preformatted()); + $this->P->addMode('preformatted',new Preformatted()); $this->P->parse("F oo\r\n x \r\n y \r\nBar\r\n"); $calls = array ( array('document_start',array()), @@ -107,7 +117,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { } function testPreformattedTab() { - $this->P->addMode('preformatted',new Doku_Parser_Mode_Preformatted()); + $this->P->addMode('preformatted',new Preformatted()); $this->P->parse("F oo\n\tx\t\n\t\ty\t\nBar\n"); $calls = array ( array('document_start',array()), @@ -124,7 +134,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { } function testPreformattedTabWinEOL() { - $this->P->addMode('preformatted',new Doku_Parser_Mode_Preformatted()); + $this->P->addMode('preformatted',new Preformatted()); $this->P->parse("F oo\r\n\tx\t\r\n\t\ty\t\r\nBar\r\n"); $calls = array ( array('document_start',array()), @@ -141,8 +151,8 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { } function testPreformattedList() { - $this->P->addMode('preformatted',new Doku_Parser_Mode_Preformatted()); - $this->P->addMode('listblock',new Doku_Parser_Mode_ListBlock()); + $this->P->addMode('preformatted',new Preformatted()); + $this->P->addMode('listblock',new Listblock()); $this->P->parse(" - x \n * y \nF oo\n x \n y \n -X\n *Y\nBar\n"); $calls = array ( array('document_start',array()), @@ -175,7 +185,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { // test for php function testPHP() { - $this->P->addMode('php',new Doku_Parser_Mode_PHP()); + $this->P->addMode('php',new Php()); $this->P->parse('Foo <php>testing</php> Bar'); $calls = array ( array('document_start',array()), @@ -192,7 +202,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { // test with for HTML function testHTML() { - $this->P->addMode('html',new Doku_Parser_Mode_HTML()); + $this->P->addMode('html',new Html()); $this->P->parse('Foo <html>testing</html> Bar'); $calls = array ( array('document_start',array()), @@ -210,9 +220,9 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser { function testPreformattedPlusHeaderAndEol() { // Note that EOL must come after preformatted! - $this->P->addMode('preformatted',new Doku_Parser_Mode_Preformatted()); - $this->P->addMode('header',new Doku_Parser_Mode_Header()); - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('preformatted',new Preformatted()); + $this->P->addMode('header',new Header()); + $this->P->addMode('eol',new Eol()); $this->P->parse("F oo\n ==Test==\n y \nBar\n"); $calls = array ( array('document_start',array()), diff --git a/_test/tests/inc/parser/parser_quote.test.php b/_test/tests/inc/parser/parser_quote.test.php index ae14671c1..6fa348671 100644 --- a/_test/tests/inc/parser/parser_quote.test.php +++ b/_test/tests/inc/parser/parser_quote.test.php @@ -1,10 +1,14 @@ <?php + +use dokuwiki\ParserMode\Eol; +use dokuwiki\ParserMode\Quote; + require_once 'parser.inc.php'; class TestOfDoku_Parser_Quote extends TestOfDoku_Parser { function testQuote() { - $this->P->addMode('quote',new Doku_Parser_Mode_Quote()); + $this->P->addMode('quote',new Quote()); $this->P->parse("abc\n> def\n>>ghi\nklm"); $calls = array ( array('document_start',array()), @@ -27,7 +31,7 @@ class TestOfDoku_Parser_Quote extends TestOfDoku_Parser { } function testQuoteWinCr() { - $this->P->addMode('quote',new Doku_Parser_Mode_Quote()); + $this->P->addMode('quote',new Quote()); $this->P->parse("abc\r\n> def\r\n>>ghi\r\nklm"); $calls = array ( array('document_start',array()), @@ -50,7 +54,7 @@ class TestOfDoku_Parser_Quote extends TestOfDoku_Parser { } function testQuoteMinumumContext() { - $this->P->addMode('quote',new Doku_Parser_Mode_Quote()); + $this->P->addMode('quote',new Quote()); $this->P->parse("\n> def\n>>ghi\n "); $calls = array ( array('document_start',array()), @@ -67,8 +71,8 @@ class TestOfDoku_Parser_Quote extends TestOfDoku_Parser { } function testQuoteEol() { - $this->P->addMode('quote',new Doku_Parser_Mode_Quote()); - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('quote',new Quote()); + $this->P->addMode('eol',new Eol()); $this->P->parse("abc\n> def\n>>ghi\nklm"); $calls = array ( array('document_start',array()), diff --git a/_test/tests/inc/parser/parser_quotes.test.php b/_test/tests/inc/parser/parser_quotes.test.php index 6f174ddae..46f87939b 100644 --- a/_test/tests/inc/parser/parser_quotes.test.php +++ b/_test/tests/inc/parser/parser_quotes.test.php @@ -1,4 +1,7 @@ <?php + +use dokuwiki\ParserMode\Quotes; + require_once 'parser.inc.php'; class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { @@ -11,7 +14,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testSingleQuoteOpening() { $raw = "Foo 'hello Bar"; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -29,7 +32,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testSingleQuoteOpeningSpecial() { $raw = "Foo said:'hello Bar"; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -47,7 +50,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testSingleQuoteClosing() { $raw = "Foo hello' Bar"; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -65,7 +68,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testSingleQuoteClosingSpecial() { $raw = "Foo hello') Bar"; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -83,7 +86,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testSingleQuotes() { $raw = "Foo 'hello' Bar"; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -103,7 +106,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testApostrophe() { $raw = "hey it's fine weather today"; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -122,7 +125,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testSingleQuotesSpecial() { $raw = "Foo ('hello') Bar"; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -142,7 +145,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testDoubleQuoteOpening() { $raw = 'Foo "hello Bar'; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -160,7 +163,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testDoubleQuoteOpeningSpecial() { $raw = 'Foo said:"hello Bar'; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -178,7 +181,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testDoubleQuoteClosing() { $raw = 'Foo hello" Bar'; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->H->status['doublequote'] = 1; $this->P->parse($raw); @@ -197,7 +200,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testDoubleQuoteClosingSpecial() { $raw = 'Foo hello") Bar'; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->H->status['doublequote'] = 1; $this->P->parse($raw); @@ -215,7 +218,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { } function testDoubleQuoteClosingSpecial2() { $raw = 'Foo hello") Bar'; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->H->status['doublequote'] = 0; $this->P->parse($raw); @@ -234,7 +237,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testDoubleQuotes() { $raw = 'Foo "hello" Bar'; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -254,7 +257,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testDoubleQuotesSpecial() { $raw = 'Foo ("hello") Bar'; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -274,7 +277,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testDoubleQuotesEnclosingBrackets() { $raw = 'Foo "{hello}" Bar'; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -294,7 +297,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testDoubleQuotesEnclosingLink() { $raw = 'Foo "[[www.domain.com]]" Bar'; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( @@ -315,7 +318,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser { function testAllQuotes() { $raw = 'There was written "He thought \'It\'s a man\'s world\'".'; - $this->P->addMode('quotes',new Doku_Parser_Mode_Quotes()); + $this->P->addMode('quotes',new Quotes()); $this->P->parse($raw); $calls = array ( diff --git a/_test/tests/inc/parser/parser_replacements.test.php b/_test/tests/inc/parser/parser_replacements.test.php index f0367dac0..46f14c799 100644 --- a/_test/tests/inc/parser/parser_replacements.test.php +++ b/_test/tests/inc/parser/parser_replacements.test.php @@ -1,10 +1,18 @@ <?php + +use dokuwiki\ParserMode\Acronym; +use dokuwiki\ParserMode\Entity; +use dokuwiki\ParserMode\Hr; +use dokuwiki\ParserMode\Multiplyentity; +use dokuwiki\ParserMode\Smiley; +use dokuwiki\ParserMode\Wordblock; + require_once 'parser.inc.php'; class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { function testSingleAcronym() { - $this->P->addMode('acronym',new Doku_Parser_Mode_Acronym(array('FOOBAR'))); + $this->P->addMode('acronym',new Acronym(array('FOOBAR'))); $this->P->parse('abc FOOBAR xyz'); $calls = array ( @@ -21,7 +29,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testAlmostAnAcronym() { - $this->P->addMode('acronym',new Doku_Parser_Mode_Acronym(array('FOOBAR'))); + $this->P->addMode('acronym',new Acronym(array('FOOBAR'))); $this->P->parse('abcFOOBARxyz'); $calls = array ( @@ -36,7 +44,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testPickAcronymCorrectly() { - $this->P->addMode('acronym',new Doku_Parser_Mode_Acronym(array('FOO'))); + $this->P->addMode('acronym',new Acronym(array('FOO'))); $this->P->parse('FOOBAR FOO'); $calls = array ( @@ -53,7 +61,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testMultipleAcronyms() { - $this->P->addMode('acronym',new Doku_Parser_Mode_Acronym(array('FOO','BAR'))); + $this->P->addMode('acronym',new Acronym(array('FOO','BAR'))); $this->P->parse('abc FOO def BAR xyz'); $calls = array ( @@ -73,7 +81,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testMultipleAcronymsWithSubset1() { - $this->P->addMode('acronym',new Doku_Parser_Mode_Acronym(array('FOO','A.FOO','FOO.1','A.FOO.1'))); + $this->P->addMode('acronym',new Acronym(array('FOO','A.FOO','FOO.1','A.FOO.1'))); $this->P->parse('FOO A.FOO FOO.1 A.FOO.1'); $calls = array ( @@ -96,7 +104,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testMultipleAcronymsWithSubset2() { - $this->P->addMode('acronym',new Doku_Parser_Mode_Acronym(array('A.FOO.1','FOO.1','A.FOO','FOO'))); + $this->P->addMode('acronym',new Acronym(array('A.FOO.1','FOO.1','A.FOO','FOO'))); $this->P->parse('FOO A.FOO FOO.1 A.FOO.1'); $calls = array ( @@ -119,7 +127,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testSingleSmileyFail() { - $this->P->addMode('smiley',new Doku_Parser_Mode_Smiley(array(':-)'))); + $this->P->addMode('smiley',new Smiley(array(':-)'))); $this->P->parse('abc:-)xyz'); $calls = array ( @@ -134,7 +142,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testSingleSmiley() { - $this->P->addMode('smiley',new Doku_Parser_Mode_Smiley(array(':-)'))); + $this->P->addMode('smiley',new Smiley(array(':-)'))); $this->P->parse('abc :-) xyz'); $calls = array ( @@ -151,7 +159,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testMultipleSmileysFail() { - $this->P->addMode('smiley',new Doku_Parser_Mode_Smiley(array(':-)','^_^'))); + $this->P->addMode('smiley',new Smiley(array(':-)','^_^'))); $this->P->parse('abc:-)x^_^yz'); $calls = array ( @@ -166,7 +174,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testMultipleSmileys() { - $this->P->addMode('smiley',new Doku_Parser_Mode_Smiley(array(':-)','^_^'))); + $this->P->addMode('smiley',new Smiley(array(':-)','^_^'))); $this->P->parse('abc :-) x ^_^ yz'); $calls = array ( @@ -186,7 +194,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { function testBackslashSmileyFail() { // This smiley is really :-\\ but escaping makes like interesting - $this->P->addMode('smiley',new Doku_Parser_Mode_Smiley(array(':-\\\\'))); + $this->P->addMode('smiley',new Smiley(array(':-\\\\'))); $this->P->parse('abc:-\\\xyz'); $calls = array ( @@ -202,7 +210,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { function testBackslashSmiley() { // This smiley is really :-\\ but escaping makes like interesting - $this->P->addMode('smiley',new Doku_Parser_Mode_Smiley(array(':-\\\\'))); + $this->P->addMode('smiley',new Smiley(array(':-\\\\'))); $this->P->parse('abc :-\\\ xyz'); $calls = array ( @@ -219,7 +227,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testSingleWordblock() { - $this->P->addMode('wordblock',new Doku_Parser_Mode_Wordblock(array('CAT'))); + $this->P->addMode('wordblock',new Wordblock(array('CAT'))); $this->P->parse('abc CAT xyz'); $calls = array ( @@ -236,7 +244,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testWordblockCase() { - $this->P->addMode('wordblock',new Doku_Parser_Mode_Wordblock(array('CAT'))); + $this->P->addMode('wordblock',new Wordblock(array('CAT'))); $this->P->parse('abc cat xyz'); $calls = array ( @@ -253,7 +261,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testMultipleWordblock() { - $this->P->addMode('wordblock',new Doku_Parser_Mode_Wordblock(array('CAT','dog'))); + $this->P->addMode('wordblock',new Wordblock(array('CAT','dog'))); $this->P->parse('abc cat x DOG yz'); $calls = array ( @@ -272,7 +280,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testSingleEntity() { - $this->P->addMode('entity',new Doku_Parser_Mode_Entity(array('->'))); + $this->P->addMode('entity',new Entity(array('->'))); $this->P->parse('x -> y'); $calls = array ( @@ -289,7 +297,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testMultipleEntities() { - $this->P->addMode('entity',new Doku_Parser_Mode_Entity(array('->','<-'))); + $this->P->addMode('entity',new Entity(array('->','<-'))); $this->P->parse('x -> y <- z'); $calls = array ( @@ -308,7 +316,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testMultiplyEntity() { - $this->P->addMode('multiplyentity',new Doku_Parser_Mode_MultiplyEntity()); + $this->P->addMode('multiplyentity',new Multiplyentity()); $this->P->parse('Foo 10x20 Bar'); $calls = array ( @@ -326,7 +334,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { function testMultiplyEntityHex() { // the multiply entity pattern should not match hex numbers, eg. 0x123 - $this->P->addMode('multiplyentity',new Doku_Parser_Mode_MultiplyEntity()); + $this->P->addMode('multiplyentity',new Multiplyentity()); $this->P->parse('Foo 0x123 Bar'); $calls = array ( @@ -341,7 +349,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testHR() { - $this->P->addMode('hr',new Doku_Parser_Mode_HR()); + $this->P->addMode('hr',new Hr()); $this->P->parse("Foo \n ---- \n Bar"); $calls = array ( @@ -359,7 +367,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser { } function testHREol() { - $this->P->addMode('hr',new Doku_Parser_Mode_HR()); + $this->P->addMode('hr',new Hr()); $this->P->parse("Foo \n----\n Bar"); $calls = array ( diff --git a/_test/tests/inc/parser/parser_table.test.php b/_test/tests/inc/parser/parser_table.test.php index f05dd29aa..7c3421a1e 100644 --- a/_test/tests/inc/parser/parser_table.test.php +++ b/_test/tests/inc/parser/parser_table.test.php @@ -1,10 +1,18 @@ <?php + +use dokuwiki\ParserMode\Eol; +use dokuwiki\ParserMode\Footnote; +use dokuwiki\ParserMode\Formatting; +use dokuwiki\ParserMode\Linebreak; +use dokuwiki\ParserMode\Table; +use dokuwiki\ParserMode\Unformatted; + require_once 'parser.inc.php'; class TestOfDoku_Parser_Table extends TestOfDoku_Parser { function testTable() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc | Row 0 Col 1 | Row 0 Col 2 | Row 0 Col 3 | @@ -48,7 +56,7 @@ def'); } function testTableWinEOL() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse("\r\nabc\r\n| Row 0 Col 1 | Row 0 Col 2 | Row 0 Col 3 |\r\n| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 |\r\ndef"); $calls = array ( array('document_start',array()), @@ -88,7 +96,7 @@ def'); } function testEmptyTable() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc | @@ -113,7 +121,7 @@ def'); } function testTableHeaders() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc ^ X | Y ^ Z | @@ -148,7 +156,7 @@ def'); } function testTableHead() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc ^ X ^ Y ^ Z ^ @@ -197,7 +205,7 @@ def'); } function testTableHeadOneRowTable() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc ^ X ^ Y ^ Z ^ @@ -232,7 +240,7 @@ def'); } function testTableHeadMultiline() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc ^ X1 ^ Y1 ^ Z1 ^ @@ -293,7 +301,7 @@ def'); } function testCellAlignment() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc | X | Y ^ Z | @@ -327,7 +335,7 @@ def'); } function testCellSpan() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc | d || e | @@ -369,7 +377,7 @@ def'); } function testCellRowSpan() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc | a | c:::|| @@ -417,7 +425,7 @@ def'); } function testCellRowSpanFirstRow() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc |::: ^ d:::^:::| ::: | @@ -475,7 +483,7 @@ def'); } function testRowSpanTableHead() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc ^ X1 ^ Y1 ^ Z1 ^ @@ -533,7 +541,7 @@ def'); } function testRowSpanAcrossTableHeadBoundary() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse(' abc ^ X1 ^ Y1 ^ Z1 ^ @@ -600,8 +608,8 @@ def'); } function testCellAlignmentFormatting() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); - $this->P->addMode('strong',new Doku_Parser_Mode_Formatting('strong')); + $this->P->addMode('table',new Table()); + $this->P->addMode('strong',new Formatting('strong')); $this->P->parse(' abc | **X** | Y ^ Z | @@ -640,8 +648,8 @@ def'); } function testTableEol() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); - $this->P->addMode('eol',new Doku_Parser_Mode_Eol()); + $this->P->addMode('table',new Table()); + $this->P->addMode('eol',new Eol()); $this->P->parse(' abc | Row 0 Col 1 | Row 0 Col 2 | Row 0 Col 3 | @@ -687,8 +695,8 @@ def'); // This is really a failing test - formatting able to spread across cols // Problem is fixing it would mean a major rewrite of table handling function testTableStrong() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); - $this->P->addMode('strong',new Doku_Parser_Mode_Formatting('strong')); + $this->P->addMode('table',new Table()); + $this->P->addMode('strong',new Formatting('strong')); $this->P->parse(' abc | **Row 0 Col 1** | **Row 0 Col 2 | Row 0 Col 3** | @@ -742,8 +750,8 @@ def'); // This is really a failing test - unformatted able to spread across cols // Problem is fixing it would mean a major rewrite of table handling function testTableUnformatted() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); - $this->P->addMode('unformatted',new Doku_Parser_Mode_Unformatted()); + $this->P->addMode('table',new Table()); + $this->P->addMode('unformatted',new Unformatted()); $this->P->parse(' abc | <nowiki>Row 0 Col 1</nowiki> | <nowiki>Row 0 Col 2 | Row 0 Col 3</nowiki> | @@ -791,8 +799,8 @@ def'); } function testTableLinebreak() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); - $this->P->addMode('linebreak',new Doku_Parser_Mode_Linebreak()); + $this->P->addMode('table',new Table()); + $this->P->addMode('linebreak',new Linebreak()); $this->P->parse(' abc | Row 0\\\\ Col 1 | Row 0 Col 2 | Row 0 Col 3 | @@ -841,8 +849,8 @@ def'); // This is really a failing test - footnote able to spread across cols // Problem is fixing it would mean a major rewrite of table handling function testTableFootnote() { - $this->P->addMode('table',new Doku_Parser_Mode_Table()); - $this->P->addMode('footnote',new Doku_Parser_Mode_Footnote()); + $this->P->addMode('table',new Table()); + $this->P->addMode('footnote',new Footnote()); $this->P->parse(' abc | ((Row 0 Col 1)) | ((Row 0 Col 2 | Row 0 Col 3)) | @@ -899,7 +907,7 @@ def'); function testTable_FS1833() { $syntax = " \n| Row 0 Col 1 |\n"; - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse($syntax); $calls = array ( array('document_start',array()), @@ -920,7 +928,7 @@ def'); */ function testTable_CellFix() { $syntax = "\n| r1c1 | r1c2 | r1c3 |\n| r2c1 |\n"; - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse($syntax); $calls = array ( array('document_start',array()), @@ -961,7 +969,7 @@ def'); */ function testTable_CellFix2() { $syntax = "\n| r1c1 |\n| r2c1 | r2c2 | r2c3 |\n"; - $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->addMode('table',new Table()); $this->P->parse($syntax); $calls = array ( array('document_start',array()), diff --git a/_test/tests/inc/parser/parser_unformatted.test.php b/_test/tests/inc/parser/parser_unformatted.test.php index f20ba5e8b..013cac80f 100644 --- a/_test/tests/inc/parser/parser_unformatted.test.php +++ b/_test/tests/inc/parser/parser_unformatted.test.php @@ -1,10 +1,13 @@ <?php + +use dokuwiki\ParserMode\Unformatted; + require_once 'parser.inc.php'; class TestOfDoku_Parser_Unformatted extends TestOfDoku_Parser { function testNowiki() { - $this->P->addMode('unformatted',new Doku_Parser_Mode_Unformatted()); + $this->P->addMode('unformatted',new Unformatted()); $this->P->parse("Foo <nowiki>testing</nowiki> Bar"); $calls = array ( array('document_start',array()), @@ -21,7 +24,7 @@ class TestOfDoku_Parser_Unformatted extends TestOfDoku_Parser { } function testDoublePercent() { - $this->P->addMode('unformatted',new Doku_Parser_Mode_Unformatted()); + $this->P->addMode('unformatted',new Unformatted()); $this->P->parse("Foo %%testing%% Bar"); $calls = array ( array('document_start',array()), |