コード例 #1
0
ファイル: OutputRulesTest.php プロジェクト: dev981/gaptest
 public function testMath()
 {
     $dom = $this->html5->loadHTML('<!doctype html>
 <html lang="en">
   <body>
     <div id="foo" class="bar baz">foo bar baz</div>
     <math>
       <mi>x</mi>
       <csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus">
         <mo>&PlusMinus;</mo>
       </csymbol>
       <mi>y</mi>
     </math>
   </body>
 </html>');
     $stream = fopen('php://temp', 'w');
     $r = new OutputRules($stream, $this->html5->getOptions());
     $t = new Traverser($dom, $stream, $r, $this->html5->getOptions());
     $list = $dom->getElementsByTagName('math');
     $r->element($list->item(0));
     $content = stream_get_contents($stream, -1, 0);
     $this->assertRegExp('|<math>|', $content);
     $this->assertRegExp('|<csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus">|', $content);
 }
コード例 #2
0
 public function testAddressTag()
 {
     $dom = $this->html5->loadHTML('<!doctype html>
 <html lang="en">
   <body>
     <address>
         <a href="../People/Raggett/">Dave Raggett</a>,
         <a href="../People/Arnaud/">Arnaud Le Hors</a>,
         contact persons for the <a href="Activity">W3C HTML Activity</a>
     </address>
   </body>
 </html>');
     $stream = fopen('php://temp', 'w');
     $r = new OutputRules($stream, $this->html5->getOptions());
     $t = new Traverser($dom, $stream, $r, $this->html5->getOptions());
     $list = $dom->getElementsByTagName('address');
     $r->element($list->item(0));
     $contents = stream_get_contents($stream, -1, 0);
     $this->assertRegExp('|<address>|', $contents);
     $this->assertRegExp('|<a href="../People/Raggett/">Dave Raggett</a>,|', $contents);
     $this->assertRegExp('|<a href="../People/Arnaud/">Arnaud Le Hors</a>,|', $contents);
     $this->assertRegExp('|contact persons for the <a href="Activity">W3C HTML Activity</a>|', $contents);
     $this->assertRegExp('|</address>|', $contents);
 }