You are here

public function OutputRulesTest::testElementWithStyle in Zircon Profile 8

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

File

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

Class

OutputRulesTest

Namespace

Masterminds\HTML5\Tests\Serializer

Code

public function testElementWithStyle() {
  $dom = $this->html5
    ->loadHTML('<!doctype html>
    <html lang="en">
      <head>
        <style>
          body > .bar {
            display: none;
          }
        </style>
      </head>
      <body>
        <div id="foo" class="bar baz">foo bar baz</div>
      </body>
    </html>');
  $stream = fopen('php://temp', 'w');
  $r = new OutputRules($stream, $this->html5
    ->getOptions());
  $t = new Traverser($dom, $stream, $r, $this->html5
    ->getOptions());
  $style = $dom
    ->getElementsByTagName('style');
  $r
    ->element($style
    ->item(0));
  $this
    ->assertEquals('<style>
          body > .bar {
            display: none;
          }
        </style>', stream_get_contents($stream, -1, 0));
}