summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-05-18 08:55:40 -0400
committerMatt Farina <[email protected]>2013-05-18 08:55:40 -0400
commit3c3f0503471071565a56ee9ea9c01ca428467ad8 (patch)
tree61bbbfd1cae9223374692b98525b683de9dc69c7 /test
parent7e8b07cb024b2cc857f19bb9ca7b0b59395e04ee (diff)
General escaping and full html5 encoding with named character references work.
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 '" => "&amp; this is a test &apos;",
- );
- }
- else {
- $tests = array(
- "& this is a test '" => "&amp; this is a test &#039;",
- );
- }
+ // 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