* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tests\HtmlSanitizer\Sanitizer; use HtmlSanitizer\Sanitizer\StringSanitizerTrait; use PHPUnit\Framework\TestCase; class StringSanitizerTraitTest extends TestCase { use StringSanitizerTrait; public function provideEncodeHtmlEntites() { $entities = [ '' => '', '"' => '"', '\'' => ''', '&' => '&', '<' => '<', '>' => '>', '<' => '&lt;', '>' => '&gt;', '+' => '+', '=' => '=', '@' => '@', '`' => '`', ]; foreach ($entities as $input => $expected) { yield $input => [$input, $expected]; } } /** * @dataProvider provideEncodeHtmlEntites */ public function testEncodeHtmlEntites($input, $expected) { $this->assertEquals($expected, $this->encodeHtmlEntities($input)); } }