Files
piratepoet/mailpoet/tests/unit/Newsletter/Renderer/EscapeHelperTest.php
Rodrigo Primo afe378ba22 Replace expect()->equals() with verify()->equals()
codeception/verify 2.1 removed support for expect()->equals() so we need
to replace it with verify()->equals().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00

33 lines
1.2 KiB
PHP

<?php declare(strict_types = 1);
namespace MailPoet\Test\Newsletter;
use MailPoet\Newsletter\Renderer\EscapeHelper as EHelper;
class EscapeHelperTest extends \MailPoetUnitTest {
public function testItEscapesHtmlText() {
verify(EHelper::escapeHtmlText('Text<tag>\'"Hello</tag>'))
->equals("Text&lt;tag&gt;'\"Hello&lt;/tag&gt;");
}
public function testItEscapesHtmlAttr() {
verify(EHelper::escapeHtmlAttr('Text<tag>\'"Hello</tag>'))
->equals("Text&lt;tag&gt;&#039;&quot;Hello&lt;/tag&gt;");
}
public function testItEscapesLinkAttr() {
verify(EHelper::escapeHtmlLinkAttr('Text<tag>\'"Hello</tag>'))
->equals("Text&lt;tag&gt;&#039;&quot;Hello&lt;/tag&gt;");
verify(EHelper::escapeHtmlLinkAttr('javaScRipt:Text<tag>\'"Hello</tag>'))
->equals("");
verify(EHelper::escapeHtmlLinkAttr(' javaScRipt:Text<tag>\'"Hello</tag>'))
->equals("");
verify(EHelper::escapeHtmlLinkAttr('DAta:Text<tag>\'"Hello</tag>'))
->equals("");
verify(EHelper::escapeHtmlLinkAttr(' DAta:Text<tag>\'"Hello</tag>'))
->equals("");
verify(EHelper::escapeHtmlLinkAttr('DAta:appliCation<tag>\'"Hello</tag>'))
->equals("");
}
}