1*504c13e8SAndreas Gohr<?php 2*504c13e8SAndreas Gohr 3*504c13e8SAndreas Gohrnamespace dokuwiki\test\Parsing\ParserMode; 4*504c13e8SAndreas Gohr 5*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Eol; 6*504c13e8SAndreas Gohruse dokuwiki\Parsing\ParserMode\Linebreak; 7*504c13e8SAndreas Gohr 8*504c13e8SAndreas Gohrclass EolTest extends ParserTestBase 9*504c13e8SAndreas Gohr{ 10*504c13e8SAndreas Gohr 11*504c13e8SAndreas Gohr function testEol() { 12*504c13e8SAndreas Gohr $this->P->addMode('eol',new Eol()); 13*504c13e8SAndreas Gohr $this->P->parse("Foo\nBar"); 14*504c13e8SAndreas Gohr $calls = [ 15*504c13e8SAndreas Gohr ['document_start',[]], 16*504c13e8SAndreas Gohr ['p_open',[]], 17*504c13e8SAndreas Gohr ['cdata',["Foo"."\n"."Bar"]], 18*504c13e8SAndreas Gohr ['p_close',[]], 19*504c13e8SAndreas Gohr ['document_end',[]], 20*504c13e8SAndreas Gohr ]; 21*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 22*504c13e8SAndreas Gohr } 23*504c13e8SAndreas Gohr 24*504c13e8SAndreas Gohr function testEolMultiple() { 25*504c13e8SAndreas Gohr $this->P->addMode('eol',new Eol()); 26*504c13e8SAndreas Gohr $this->P->parse("Foo\n\nbar\nFoo"); 27*504c13e8SAndreas Gohr $calls = [ 28*504c13e8SAndreas Gohr ['document_start',[]], 29*504c13e8SAndreas Gohr ['p_open',[]], 30*504c13e8SAndreas Gohr ['cdata',["Foo"]], 31*504c13e8SAndreas Gohr ['p_close',[]], 32*504c13e8SAndreas Gohr ['p_open',[]], 33*504c13e8SAndreas Gohr ['cdata',["bar"."\n"."Foo"]], 34*504c13e8SAndreas Gohr ['p_close',[]], 35*504c13e8SAndreas Gohr ['document_end',[]], 36*504c13e8SAndreas Gohr ]; 37*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 38*504c13e8SAndreas Gohr } 39*504c13e8SAndreas Gohr 40*504c13e8SAndreas Gohr function testWinEol() { 41*504c13e8SAndreas Gohr $this->P->addMode('eol',new Eol()); 42*504c13e8SAndreas Gohr $this->P->parse("Foo\r\nBar"); 43*504c13e8SAndreas Gohr $calls = [ 44*504c13e8SAndreas Gohr ['document_start',[]], 45*504c13e8SAndreas Gohr ['p_open',[]], 46*504c13e8SAndreas Gohr ['cdata',["Foo"."\n"."Bar"]], 47*504c13e8SAndreas Gohr ['p_close',[]], 48*504c13e8SAndreas Gohr ['document_end',[]], 49*504c13e8SAndreas Gohr ]; 50*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 51*504c13e8SAndreas Gohr } 52*504c13e8SAndreas Gohr 53*504c13e8SAndreas Gohr function testLinebreak() { 54*504c13e8SAndreas Gohr $this->P->addMode('linebreak',new Linebreak()); 55*504c13e8SAndreas Gohr $this->P->parse('Foo\\\\ Bar'); 56*504c13e8SAndreas Gohr $calls = [ 57*504c13e8SAndreas Gohr ['document_start',[]], 58*504c13e8SAndreas Gohr ['p_open',[]], 59*504c13e8SAndreas Gohr ['cdata',["\nFoo"]], 60*504c13e8SAndreas Gohr ['linebreak',[]], 61*504c13e8SAndreas Gohr ['cdata',["Bar"]], 62*504c13e8SAndreas Gohr ['p_close',[]], 63*504c13e8SAndreas Gohr ['document_end',[]], 64*504c13e8SAndreas Gohr ]; 65*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 66*504c13e8SAndreas Gohr } 67*504c13e8SAndreas Gohr 68*504c13e8SAndreas Gohr function testLinebreakPlusEol() { 69*504c13e8SAndreas Gohr $this->P->addMode('linebreak',new Linebreak()); 70*504c13e8SAndreas Gohr $this->P->addMode('eol',new Eol()); 71*504c13e8SAndreas Gohr $this->P->parse('Foo\\\\'."\n\n".'Bar'); 72*504c13e8SAndreas Gohr 73*504c13e8SAndreas Gohr $calls = [ 74*504c13e8SAndreas Gohr ['document_start',[]], 75*504c13e8SAndreas Gohr ['p_open',[]], 76*504c13e8SAndreas Gohr ['cdata',["Foo"]], 77*504c13e8SAndreas Gohr ['linebreak',[]], 78*504c13e8SAndreas Gohr ['p_close',[]], 79*504c13e8SAndreas Gohr ['p_open',[]], 80*504c13e8SAndreas Gohr ['cdata',["Bar"]], 81*504c13e8SAndreas Gohr ['p_close',[]], 82*504c13e8SAndreas Gohr ['document_end',[]], 83*504c13e8SAndreas Gohr ]; 84*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 85*504c13e8SAndreas Gohr } 86*504c13e8SAndreas Gohr 87*504c13e8SAndreas Gohr function testLinebreakInvalid() { 88*504c13e8SAndreas Gohr $this->P->addMode('linebreak',new Linebreak()); 89*504c13e8SAndreas Gohr $this->P->parse('Foo\\\\Bar'); 90*504c13e8SAndreas Gohr $calls = [ 91*504c13e8SAndreas Gohr ['document_start',[]], 92*504c13e8SAndreas Gohr ['p_open',[]], 93*504c13e8SAndreas Gohr ['cdata',["\n".'Foo\\\\Bar']], 94*504c13e8SAndreas Gohr ['p_close',[]], 95*504c13e8SAndreas Gohr ['document_end',[]], 96*504c13e8SAndreas Gohr ]; 97*504c13e8SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 98*504c13e8SAndreas Gohr } 99*504c13e8SAndreas Gohr 100*504c13e8SAndreas Gohr} 101