function StyleTestBase::storeViewPreview

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Plugin/StyleTestBase.php \Drupal\Tests\views\Kernel\Plugin\StyleTestBase::storeViewPreview()
  2. 10 core/modules/views/tests/src/Kernel/Plugin/StyleTestBase.php \Drupal\Tests\views\Kernel\Plugin\StyleTestBase::storeViewPreview()
  3. 11.x core/modules/views/tests/src/Kernel/Plugin/StyleTestBase.php \Drupal\Tests\views\Kernel\Plugin\StyleTestBase::storeViewPreview()

Stores a view output in the elements.

2 calls to StyleTestBase::storeViewPreview()
StyleMappingTest::mappedOutputHelper in core/modules/views/tests/src/Kernel/Plugin/StyleMappingTest.php
Tests the mapping of fields.
StyleUnformattedTest::testDefaultRowClasses in core/modules/views/tests/src/Kernel/Plugin/StyleUnformattedTest.php
Make sure that the default css classes works as expected.

File

core/modules/views/tests/src/Kernel/Plugin/StyleTestBase.php, line 23

Class

StyleTestBase
Tests some general style plugin related functionality.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

public function storeViewPreview($output) {
    $html5 = new HTML5();
    $htmlDom = $html5->loadHTML('<html><body>' . $output . '</body></html>');
    if ($htmlDom) {
        // It's much easier to work with simplexml than DOM, luckily enough
        // we can just simply import our DOM tree.
        $this->elements = simplexml_import_dom($htmlDom);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.