summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/HTML5/Parser/EventStack.php3
-rw-r--r--test/HTML5/Parser/TokenizerTest.php15
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',