diff options
author | Matt Farina <[email protected]> | 2013-11-05 22:38:08 -0500 |
---|---|---|
committer | Matt Farina <[email protected]> | 2013-11-05 22:38:08 -0500 |
commit | 26ccf6eec90e37636982f08ac5d070658a7bd0a5 (patch) | |
tree | 1ffb387c01bf1c500e37520ed271f4f55c7a447a | |
parent | 1cb53d256c89b73d8b8b212c68ba0202fbded06e (diff) |
Added tests for the output of processor instructions that lead to fixing that method.
-rw-r--r-- | src/HTML5/Serializer/OutputRules.php | 2 | ||||
-rw-r--r-- | test/HTML5/Serializer/OutputRulesTest.php | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/HTML5/Serializer/OutputRules.php b/src/HTML5/Serializer/OutputRules.php index bb0cb45..bc57346 100644 --- a/src/HTML5/Serializer/OutputRules.php +++ b/src/HTML5/Serializer/OutputRules.php @@ -120,7 +120,7 @@ class OutputRules implements \HTML5\Serializer\RulesInterface { } public function processorInstruction($ele) { - $this->wr('<?')->wr($ele->target)->wr($ele->data)->wr(' ?>'); + $this->wr('<?')->wr($ele->target)->wr(' ')->wr($ele->data)->wr('?>'); } /** diff --git a/test/HTML5/Serializer/OutputRulesTest.php b/test/HTML5/Serializer/OutputRulesTest.php index a451055..61e2d50 100644 --- a/test/HTML5/Serializer/OutputRulesTest.php +++ b/test/HTML5/Serializer/OutputRulesTest.php @@ -330,4 +330,15 @@ class OutputRulesTest extends \HTML5\Tests\TestCase { $this->assertRegExp('|<csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus">|', $content); } + function testProcessorInstruction() { + $dom = \HTML5::loadHTMLFragment('<?foo bar ?>'); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, \HTML5::options()); + $t = new Traverser($dom, $stream, $r, \HTML5::options()); + + $r->processorInstruction($dom->firstChild); + $content = stream_get_contents($stream, -1, 0); + $this->assertRegExp('|<\?foo bar \?>|', $content); + } } |