|
@@ -0,0 +1,28 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace fphammerle\helpers\tests;
|
|
|
+
|
|
|
+use fphammerle\helpers\HtmlHelper;
|
|
|
+
|
|
|
+class HtmlHelperTest extends \PHPUnit_Framework_TestCase
|
|
|
+{
|
|
|
+ public function encodeProvider()
|
|
|
+ {
|
|
|
+ return [
|
|
|
+ ['abc', 'abc'],
|
|
|
+ ['可以', '可以'],
|
|
|
+ ['⚕', '⚕'],
|
|
|
+ ['<abc>', '<abc>'],
|
|
|
+ ['alert(":-)");', 'alert(":-)");'],
|
|
|
+ ['alert(\':-)\');', 'alert(':-)');'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * @dataProvider encodeProvider
|
|
|
+ */
|
|
|
+ public function testEncode($string, $expected)
|
|
|
+ {
|
|
|
+ $this->assertSame($expected, HtmlHelper::encode($string));
|
|
|
+ }
|
|
|
+}
|