@@ -45,9 +45,9 @@ class ConvertEmailLinksImplementationTest extends UnitTestCase
45
45
*/
46
46
protected $ mockNode ;
47
47
48
- public function setUp ()
48
+ public function setUp (): void
49
49
{
50
- $ this ->convertEmailLinks = $ this ->getAccessibleMock (ConvertEmailLinksImplementation::class, ['getValue ' ], [], '' , false );
50
+ $ this ->convertEmailLinks = $ this ->getAccessibleMock (ConvertEmailLinksImplementation::class, ['fusionValue ' ], [], '' , false );
51
51
52
52
$ this ->mockContext = $ this ->getMockBuilder (Context::class)->disableOriginalConstructor ()->getMock ();
53
53
$ this ->mockContext ->expects ($ this ->any ())->method ('getWorkspaceName ' )->will ($ this ->returnValue ('live ' ));
@@ -63,7 +63,6 @@ public function setUp()
63
63
$ linkNameConverter ->setReplacementString (' (at) ' );
64
64
$ this ->convertEmailLinks ->_set ('linkNameConverter ' , $ linkNameConverter );
65
65
$ this ->convertEmailLinks ->_set ('mailToHrefConverter ' , new Mailto2HrefObfuscatingConverter (15 ));
66
-
67
66
}
68
67
69
68
/**
@@ -72,13 +71,20 @@ public function setUp()
72
71
*/
73
72
public function emailsAreConverted ($ rawText , $ expectedText )
74
73
{
75
- $ this ->convertEmailLinks ->expects ($ this ->atLeastOnce ())->method ('getValue ' )->will ($ this ->returnValue ($ rawText ));
74
+ $ this ->convertEmailLinks
75
+ ->expects (self ::atLeastOnce ())
76
+ ->method ('fusionValue ' )
77
+ ->will ($ this ->returnValueMap ([
78
+ ['value ' , $ rawText ],
79
+ ['patternMailTo ' , '/(href=")mailto:([^"]*)/ ' ],
80
+ ['patternMailDisplay ' , '/(href="mailto:[^>]*>)([^<]*)/ ' ]
81
+ ]));
76
82
77
83
$ actualResult = $ this ->convertEmailLinks ->evaluate ();
78
84
$ this ->assertSame ($ expectedText , $ actualResult );
79
85
}
80
86
81
- public function emailTexts ()
87
+ public function emailTexts (): array
82
88
{
83
89
return [
84
90
'just some text not to touch ' => [
@@ -100,6 +106,10 @@ public function emailTexts()
100
106
'email address with space at the beginning ' => [
101
107
102
108
'Email <a href="javascript:linkTo_UnCryptMailto( \'ithiOtmpbeat-rdb \', -15)">test (at) example.com</a> '
109
+ ],
110
+ 'email address with attributes after href ' => [
111
+ 'Email <a href="mailto: [email protected] " itemprop="email">[email protected] </a> ' ,
112
+ 'Email <a href="javascript:linkTo_UnCryptMailto( \'ithiOtmpbeat-rdb \', -15)" itemprop="email">test (at) example.com</a> '
103
113
]
104
114
];
105
115
}
0 commit comments