summaryrefslogtreecommitdiff
path: root/test/HTML5/Serializer/OutputRulesTest.php
diff options
context:
space:
mode:
authorAsmir Mustafic <[email protected]>2014-02-11 08:51:06 +0100
committerAsmir Mustafic <[email protected]>2014-02-11 08:51:06 +0100
commitfe713d549d436b63e8367756f19cb456e60d2ff3 (patch)
tree1c331857b1f18697b866b4f919183bf6e60be540 /test/HTML5/Serializer/OutputRulesTest.php
parent1a89c6b18851f446c4842514c93e8b6698ae0b2d (diff)
Tests and code style + nbsp handling
Diffstat (limited to 'test/HTML5/Serializer/OutputRulesTest.php')
-rw-r--r--test/HTML5/Serializer/OutputRulesTest.php36
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('&\'<>"', '&amp;\'<>"', '&amp;\'&lt;&gt;"'),
- array('.+#', '.+#', '&period;&plus;&num;'),
- );
- }
+
function getEncData(){
return array(
- array(false, '&\'<>"', '&amp;\'&lt;&gt;"', '&amp;\'&lt;&gt;"'),
- array(false, 'This + is. a < test', 'This + is. a &lt; test', 'This &plus; is&period; a &lt; test'),
- array(false, '.+#', '.+#', '&period;&plus;&num;'),
-
- array(true, '.+#\'', '.+#\'', '&period;&plus;&num;\''),
- array(true, '&".<', '&amp;&quot;.<', '&amp;&quot;&period;&lt;'),
- array(true, '&\'<>"', '&amp;\'<>&quot;', '&amp;\'&lt;&gt;&quot;'),
+ array(false, '&\'<>"', '&amp;\'&lt;&gt;"', '&amp;&apos;&lt;&gt;&quot;'),
+ array(false, 'This + is. a < test', 'This + is. a &lt; test', 'This &plus; is&period; a &lt; test'),
+ array(false, '.+#', '.+#', '&period;&plus;&num;'),
+
+ array(true, '.+#\'', '.+#\'', '&period;&plus;&num;&apos;'),
+ array(true, '&".<', '&amp;&quot;.<', '&amp;&quot;&period;&lt;'),
+ array(true, '&\'<>"', '&amp;\'<>&quot;', '&amp;&apos;&lt;&gt;&quot;'),
+ array(true, "\xc2\xa0\"'", '&nbsp;&quot;\'', '&nbsp;&quot;&apos;'),
);
}
+
/**
* 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() {