diff options
author | Technosophos <[email protected]> | 2013-04-16 14:45:56 -0500 |
---|---|---|
committer | Technosophos <[email protected]> | 2013-04-16 14:45:56 -0500 |
commit | 186ee9d481aded712459a4371619fcdbd33b443a (patch) | |
tree | 58f28af8c784153f9396b62b3032056aeca923c2 /test/HTML5 | |
parent | 2f941ff18eb9f87e84ba2768fbdaf969be9e9fd2 (diff) |
Added support for processing instructions.
Diffstat (limited to 'test/HTML5')
-rw-r--r-- | test/HTML5/Parser/EventStack.php | 3 | ||||
-rw-r--r-- | test/HTML5/Parser/TokenizerTest.php | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/HTML5/Parser/EventStack.php b/test/HTML5/Parser/EventStack.php index e865507..f197855 100644 --- a/test/HTML5/Parser/EventStack.php +++ b/test/HTML5/Parser/EventStack.php @@ -71,6 +71,9 @@ class EventStack implements EventHandler { $this->store('error', func_get_args()); } + public function processingInstruction($name, $data = NULL) { + $this->store('pi', func_get_args()); + } } class EventStackParseError extends \Exception { diff --git a/test/HTML5/Parser/TokenizerTest.php b/test/HTML5/Parser/TokenizerTest.php index fb33e37..c4c66e7 100644 --- a/test/HTML5/Parser/TokenizerTest.php +++ b/test/HTML5/Parser/TokenizerTest.php @@ -106,6 +106,8 @@ class TokenizerTest extends \HTML5\Tests\TestCase { '<!CDATA[[ test ]]>', '<![CDATA[', '<![CDATA[hellooooo hello', + '<? Hello World ?>', + '<? Hello World', ); foreach ($bogus as $str) { $events = $this->parse($str); @@ -258,6 +260,19 @@ class TokenizerTest extends \HTML5\Tests\TestCase { } } + public function testProcessorInstruction() { + $good = array( + '<?hph ?>' => 'hph', + '<?hph echo "Hello World"; ?>' => array('hph', 'echo "Hello World"; '), + "<?hph \necho 'Hello World';\n?>" => array('hph', "echo 'Hello World';\n"), + ); + foreach ($good as $test => $expects) { + $events = $this->parse($test); + $this->assertEquals(2, $events->depth(), "Counting events for '$test': " . print_r($events, TRUE)); + $this->assertEventEquals('pi', $expects, $events->get(0)); + } + } + public function testText() { $good = array( 'a<br>b', |