summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/HTML5/Serializer/TraverserTest.php24
1 files changed, 11 insertions, 13 deletions
diff --git a/test/HTML5/Serializer/TraverserTest.php b/test/HTML5/Serializer/TraverserTest.php
index 1a17af3..fb8ed34 100644
--- a/test/HTML5/Serializer/TraverserTest.php
+++ b/test/HTML5/Serializer/TraverserTest.php
@@ -94,24 +94,22 @@ class TraverserTest extends \HTML5\Tests\TestCase {
function testEnc() {
- // @todo: add more tests.
- // PHP 5.4+ has much better encoding and properly supports html5.
- if (defined('ENT_HTML5')) {
- $tests = array(
- "& this is a test '" => "& this is a test '",
- );
- }
- else {
- $tests = array(
- "& this is a test '" => "& this is a test '",
- );
- }
+ // Test basic escaping of text.
+ $tests = array(
+ '&\'<>"' => '&amp;&#039;&lt;&gt;&quot;',
+ 'This + is. a < test' => 'This + is. a &lt; test',
+ );
list($t, $s) = $this->getTraverser();
-
$m = $this->getProtectedMethod('enc');
foreach ($tests as $test => $expected) {
$this->assertEquals($expected, $m->invoke($t, $test));
}
+
+ list($t, $s) = $this->getTraverser();
+ $t->encodeOutput(TRUE);
+ $m = $this->getProtectedMethod('enc');
+
+ $this->assertEquals('&period;&plus;&num;', $m->invoke($t, '.+#'));
}
} \ No newline at end of file