From 3c3f0503471071565a56ee9ea9c01ca428467ad8 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Sat, 18 May 2013 08:55:40 -0400 Subject: General escaping and full html5 encoding with named character references work. --- test/HTML5/Serializer/TraverserTest.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'test/HTML5/Serializer') 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 -- cgit v1.2.3