@@ -77,18 +77,18 @@ public function emailsAreConverted($rawText, $expectedText)
77
77
->will ($ this ->returnValueMap ([
78
78
['value ' , $ rawText ],
79
79
['patternMailTo ' , '/(href=")mailto:([^"]*)/ ' ],
80
- ['patternMailDisplay ' , '/ (href="mailto:[^>]*>)([^<]*)/ ' ]
80
+ ['patternMailDisplay ' , '| (href="mailto:[^>]*>)(.*?)(<\/a>)| ' ]
81
81
]));
82
82
83
83
$ actualResult = $ this ->convertEmailLinks ->evaluate ();
84
84
$ this ->assertSame ($ expectedText , $ actualResult );
85
85
}
86
86
87
- public function emailTexts (): array
87
+ static public function emailTexts (): array
88
88
{
89
89
90
- $ htmlEncodedDecryptionString = htmlspecialchars ('javascript:linkTo_UnCryptMailto( \'ithiOtmpbeat-rdb \', -15) ' );
91
- $ htmlEncodedSecondDecryptionString = htmlspecialchars ('javascript:linkTo_UnCryptMailto( \'uddqpgOtmpbeat-rdb \', -15) ' );
90
+ $ htmlEncodedDecryptionString = htmlspecialchars ('javascript:linkTo_UnCryptMailto( \'ithiOtmpbeat-rdb \',-15) ' , ENT_NOQUOTES );
91
+ $ htmlEncodedSecondDecryptionString = htmlspecialchars ('javascript:linkTo_UnCryptMailto( \'uddqpgOtmpbeat-rdb \',-15) ' , ENT_NOQUOTES );
92
92
93
93
return [
94
94
'just some text not to touch ' => [
@@ -114,6 +114,14 @@ public function emailTexts(): array
114
114
'email address with attributes after href ' => [
115
115
'Email <a href="mailto: [email protected] " itemprop="email">[email protected] </a> ' ,
116
116
'Email <a href=" ' . $ htmlEncodedDecryptionString . '" itemprop="email">test (at) example.com</a> '
117
+ ],
118
+ 'email address enclosed by HTML tag ' => [
119
+ 'Email <a href="mailto: [email protected] " itemprop="email"><strong>[email protected] </strong></a> ' ,
120
+ 'Email <a href=" ' . $ htmlEncodedDecryptionString . '" itemprop="email"><strong>test (at) example.com</strong></a> '
121
+ ],
122
+ 'email address in link tag enclosed by multiple styling tags ' => [
123
+ 'Email <a href="mailto: [email protected] " itemprop="email"><i class="fa-light fa-paper-plane"></i><span class="btn__text">[email protected] </span></a> ' ,
124
+ 'Email <a href=" ' . $ htmlEncodedDecryptionString . '" itemprop="email"><i class="fa-light fa-paper-plane"></i><span class="btn__text">test (at) example.com</span></a> '
117
125
]
118
126
];
119
127
}
0 commit comments