You are here

public function TraverserTest::testFragment in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/test/HTML5/Serializer/TraverserTest.php \Masterminds\HTML5\Tests\Serializer\TraverserTest::testFragment()

File

vendor/masterminds/html5/test/HTML5/Serializer/TraverserTest.php, line 74

Class

TraverserTest

Namespace

Masterminds\HTML5\Tests\Serializer

Code

public function testFragment() {
  $html = '<span class="bar">foo</span><span></span><div>bar</div>';
  $input = new \Masterminds\HTML5\Parser\StringInputStream($html);
  $dom = $this->html5
    ->parseFragment($input);
  $this
    ->assertInstanceOf('\\DOMDocumentFragment', $dom);
  $stream = fopen('php://temp', 'w');
  $r = new OutputRules($stream, $this->html5
    ->getOptions());
  $t = new Traverser($dom, $stream, $r, $this->html5
    ->getOptions());
  $out = $t
    ->walk();
  $this
    ->assertEquals($html, stream_get_contents($stream, -1, 0));
}