diff options
Diffstat (limited to 'test/HTML5/Serializer/OutputRulesTest.php')
-rw-r--r-- | test/HTML5/Serializer/OutputRulesTest.php | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/test/HTML5/Serializer/OutputRulesTest.php b/test/HTML5/Serializer/OutputRulesTest.php index f81c0bc..fcb1ac6 100644 --- a/test/HTML5/Serializer/OutputRulesTest.php +++ b/test/HTML5/Serializer/OutputRulesTest.php @@ -234,38 +234,34 @@ class OutputRulesTest extends \HTML5\Tests\TestCase { $m->invoke($o, 'foo'); $this->assertEquals('foo', stream_get_contents($s, -1, 0)); } - function getEncDataAttssribute(){ - return array( - array('&\'<>"', '&\'<>"', '&\'<>"'), - array('.+#', '.+#', '.+#'), - ); - } + function getEncData(){ return array( - array(false, '&\'<>"', '&\'<>"', '&\'<>"'), - array(false, 'This + is. a < test', 'This + is. a < test', 'This + is. a < test'), - array(false, '.+#', '.+#', '.+#'), - - array(true, '.+#\'', '.+#\'', '.+#\''), - array(true, '&".<', '&".<', '&".<'), - array(true, '&\'<>"', '&\'<>"', '&\'<>"'), + array(false, '&\'<>"', '&\'<>"', '&'<>"'), + array(false, 'This + is. a < test', 'This + is. a < test', 'This + is. a < test'), + array(false, '.+#', '.+#', '.+#'), + + array(true, '.+#\'', '.+#\'', '.+#''), + array(true, '&".<', '&".<', '&".<'), + array(true, '&\'<>"', '&\'<>"', '&'<>"'), + array(true, "\xc2\xa0\"'", ' "\'', ' "''), ); } + /** * Test basic escaping of text. * @dataProvider getEncData */ function testEnc($isAttribute, $test, $expected, $expectedEncoded) { - list($o, $s) = $this->getOutputRules(); - $m = $this->getProtectedMethod('enc'); - - $this->assertEquals($expected, $m->invoke($o, $test, $isAttribute)); + list($o, $s) = $this->getOutputRules(); + $m = $this->getProtectedMethod('enc'); - list($o, $s) = $this->getOutputRules(array('encode_entities' => TRUE)); - $m = $this->getProtectedMethod('enc'); + $this->assertEquals($expected, $m->invoke($o, $test, $isAttribute)); - $this->assertEquals($expectedEncoded, $m->invoke($o, $test, $isAttribute)); + list($o, $s) = $this->getOutputRules(array('encode_entities' => TRUE)); + $m = $this->getProtectedMethod('enc'); + $this->assertEquals($expectedEncoded, $m->invoke($o, $test, $isAttribute)); } function testAttrs() { |