Skip to content

Commit

Permalink
apply htmlspecialchars on expected decryption string
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsjung committed Jul 27, 2022
1 parent 12122fb commit 4f1c7ed
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Tests/Unit/Fusion/ConvertEmailLinksImplementationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,30 +86,34 @@ public function emailsAreConverted($rawText, $expectedText)

public function emailTexts(): array
{

$htmlEncodedDecryptionString = htmlspecialchars('javascript:linkTo_UnCryptMailto(\'ithiOtmpbeat-rdb\', -15)');
$htmlEncodedSecondDecryptionString = htmlspecialchars('javascript:linkTo_UnCryptMailto(\'uddqpgOtmpbeat-rdb\', -15)');

return [
'just some text not to touch' => [
' this Is some string with line' . chr(10) . ' breaks, special chärß and leading/trailing space ',
' this Is some string with line' . chr(10) . ' breaks, special chärß and leading/trailing space '
],
'single mail link in text' => [
'Email <a href="mailto:[email protected]">[email protected]</a>',
'Email <a href="javascript:linkTo_UnCryptMailto(\'ithiOtmpbeat-rdb\', -15)">test (at) example.com</a>'
'Email <a href="' . $htmlEncodedDecryptionString . '">test (at) example.com</a>'
],
'multiple mail links in text' => [
'Email <a href="mailto:[email protected]">[email protected]</a> and afterwards another email <a href="mailto:[email protected]">[email protected]</a>',
'Email <a href="javascript:linkTo_UnCryptMailto(\'ithiOtmpbeat-rdb\', -15)">test (at) example.com</a> and afterwards another email <a href="javascript:linkTo_UnCryptMailto(\'uddqpgOtmpbeat-rdb\', -15)">foobar (at) example.com</a>'
'Email <a href="' . $htmlEncodedDecryptionString . '">test (at) example.com</a> and afterwards another email <a href="' . $htmlEncodedSecondDecryptionString . '">foobar (at) example.com</a>'
],
'email address outside of link' => [
'Email [email protected] should not be replaced',
'Email [email protected] should not be replaced'
],
'email address with space at the beginning' => [
'Email <a href="mailto: [email protected]">[email protected]</a>',
'Email <a href="javascript:linkTo_UnCryptMailto(\'ithiOtmpbeat-rdb\', -15)">test (at) example.com</a>'
'Email <a href="' . $htmlEncodedDecryptionString . '">test (at) example.com</a>'
],
'email address with attributes after href' => [
'Email <a href="mailto: [email protected]" itemprop="email">[email protected]</a>',
'Email <a href="javascript:linkTo_UnCryptMailto(\'ithiOtmpbeat-rdb\', -15)" itemprop="email">test (at) example.com</a>'
'Email <a href="' . $htmlEncodedDecryptionString . '" itemprop="email">test (at) example.com</a>'
]
];
}
Expand Down

0 comments on commit 4f1c7ed

Please sign in to comment.