1*465aec67SAndreas Gohr<?php 2*465aec67SAndreas Gohr 3*465aec67SAndreas Gohrnamespace dokuwiki\test\Parsing\ParserMode; 4*465aec67SAndreas Gohr 5*465aec67SAndreas Gohruse dokuwiki\Parsing\ParserMode\Emaillink; 6*465aec67SAndreas Gohr 7*465aec67SAndreas Gohr/** 8*465aec67SAndreas Gohr * Tests for the {@see Emaillink} parser mode: bare email addresses inside `<...>` envelopes. 9*465aec67SAndreas Gohr * 10*465aec67SAndreas Gohr * @group parser_links 11*465aec67SAndreas Gohr */ 12*465aec67SAndreas Gohrclass EmaillinkTest extends ParserTestBase 13*465aec67SAndreas Gohr{ 14*465aec67SAndreas Gohr function testEmail() { 15*465aec67SAndreas Gohr $this->P->addMode('emaillink', new Emaillink()); 16*465aec67SAndreas Gohr $this->P->parse("Foo <bugs@php.net> Bar"); 17*465aec67SAndreas Gohr $calls = [ 18*465aec67SAndreas Gohr ['document_start', []], 19*465aec67SAndreas Gohr ['p_open', []], 20*465aec67SAndreas Gohr ['cdata', ["\n" . 'Foo ']], 21*465aec67SAndreas Gohr ['emaillink', ['bugs@php.net', 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*465aec67SAndreas Gohr function testEmailRFC2822() { 30*465aec67SAndreas Gohr $this->P->addMode('emaillink', new Emaillink()); 31*465aec67SAndreas Gohr $this->P->parse("Foo <~fix+bug's.for/ev{e}r@php.net> Bar"); 32*465aec67SAndreas Gohr $calls = [ 33*465aec67SAndreas Gohr ['document_start', []], 34*465aec67SAndreas Gohr ['p_open', []], 35*465aec67SAndreas Gohr ['cdata', ["\n" . 'Foo ']], 36*465aec67SAndreas Gohr ['emaillink', ["~fix+bug's.for/ev{e}r@php.net", null]], 37*465aec67SAndreas Gohr ['cdata', [' Bar']], 38*465aec67SAndreas Gohr ['p_close', []], 39*465aec67SAndreas Gohr ['document_end', []], 40*465aec67SAndreas Gohr ]; 41*465aec67SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 42*465aec67SAndreas Gohr } 43*465aec67SAndreas Gohr 44*465aec67SAndreas Gohr function testEmailCase() { 45*465aec67SAndreas Gohr $this->P->addMode('emaillink', new Emaillink()); 46*465aec67SAndreas Gohr $this->P->parse("Foo <bugs@pHp.net> Bar"); 47*465aec67SAndreas Gohr $calls = [ 48*465aec67SAndreas Gohr ['document_start', []], 49*465aec67SAndreas Gohr ['p_open', []], 50*465aec67SAndreas Gohr ['cdata', ["\n" . 'Foo ']], 51*465aec67SAndreas Gohr ['emaillink', ['bugs@pHp.net', null]], 52*465aec67SAndreas Gohr ['cdata', [' Bar']], 53*465aec67SAndreas Gohr ['p_close', []], 54*465aec67SAndreas Gohr ['document_end', []], 55*465aec67SAndreas Gohr ]; 56*465aec67SAndreas Gohr $this->assertCalls($calls, $this->H->calls); 57*465aec67SAndreas Gohr } 58*465aec67SAndreas Gohr} 59