コード例 #1
0
 public function invoke($test)
 {
     // this is totally the wrong interface to use, but
     // for now we need testing
     $tokenizer = new Tokenizer($test['data']);
     $GLOBALS['TIME'] -= get_microtime();
     if (isset($test['document-fragment'])) {
         $tokenizer->parseFragment($test['document-fragment']);
     } else {
         $tokenizer->parse();
     }
     $GLOBALS['TIME'] += get_microtime();
     $this->assertIdentical($test['document'], TestData::strDom($tokenizer->save()), $test);
 }
コード例 #2
0
    function testStrDom()
    {
        $dom = new DOMDocument();
        $dom->loadHTML('<!DOCTYPE html PUBLIC "http://foo" "http://bar"><html><body foo="bar" baz="1">foo<b>bar</b>asdf</body></html>');
        $this->assertIdentical(TestData::strDom($dom), <<<RESULT
| <!DOCTYPE html "http://foo" "http://bar">
| <html>
|   <body>
|     baz="1"
|     foo="bar"
|     "foo"
|     <b>
|       "bar"
|     "asdf"
RESULT
);
    }