You are here

protected function StyleTest::getHtmlDom in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/Plugin/StyleTest.php \Drupal\Tests\views\Kernel\Plugin\StyleTest::getHtmlDom()
  2. 9 core/modules/views/tests/src/Kernel/Plugin/StyleTest.php \Drupal\Tests\views\Kernel\Plugin\StyleTest::getHtmlDom()

Returns a view output as SimpleXMLElement.

Return value

\SimpleXMLElement|null The HTML DOM.

1 call to StyleTest::getHtmlDom()
StyleTest::testCustomRowClasses in core/modules/views/tests/src/Kernel/Plugin/StyleTest.php
Tests custom CSS row classes.

File

core/modules/views/tests/src/Kernel/Plugin/StyleTest.php, line 311

Class

StyleTest
Tests general style functionality.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

protected function getHtmlDom($output) {
  $html_dom = new \DOMDocument();
  @$html_dom
    ->loadHTML($output);
  if ($html_dom) {

    // It's much easier to work with simplexml than DOM, luckily enough
    // we can just simply import our DOM tree.
    return simplexml_import_dom($html_dom);
  }
  return NULL;
}