You are here

public function OutputRulesTest::testBooleanAttrs in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/masterminds/html5/test/HTML5/Serializer/OutputRulesTest.php \Masterminds\HTML5\Tests\Serializer\OutputRulesTest::testBooleanAttrs()

@dataProvider booleanAttributes

File

vendor/masterminds/html5/test/HTML5/Serializer/OutputRulesTest.php, line 473

Class

OutputRulesTest

Namespace

Masterminds\HTML5\Tests\Serializer

Code

public function testBooleanAttrs($html) {
  $dom = $this->html5
    ->loadHTML('<!doctype html><html lang="en"><body>' . $html . '</body></html>');
  $stream = fopen('php://temp', 'w');
  $r = new OutputRules($stream, $this->html5
    ->getOptions());
  $t = new Traverser($dom, $stream, $r, $this->html5
    ->getOptions());
  $node = $dom
    ->getElementsByTagName('body')
    ->item(0)->firstChild;
  $m = $this
    ->getProtectedMethod('attrs');
  $m
    ->invoke($r, $node);
  $content = stream_get_contents($stream, -1, 0);
  $html = preg_replace('~<[a-z]+(.*)></[a-z]+>~', '\\1', $html);
  $html = preg_replace('~<[a-z]+(.*)/?>~', '\\1', $html);
  $this
    ->assertEquals($content, $html);
}