diff options
author | Matt Farina <[email protected]> | 2013-05-18 08:55:40 -0400 |
---|---|---|
committer | Matt Farina <[email protected]> | 2013-05-18 08:55:40 -0400 |
commit | 3c3f0503471071565a56ee9ea9c01ca428467ad8 (patch) | |
tree | 61bbbfd1cae9223374692b98525b683de9dc69c7 /test | |
parent | 7e8b07cb024b2cc857f19bb9ca7b0b59395e04ee (diff) |
General escaping and full html5 encoding with named character references work.
Diffstat (limited to 'test')
-rw-r--r-- | test/HTML5/Serializer/TraverserTest.php | 24 |
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( + '&\'<>"' => '&'<>"', + 'This + is. a < test' => 'This + is. a < 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('.+#', $m->invoke($t, '.+#')); } }
\ No newline at end of file |