class StyleTestBase

Same name and namespace in other branches
  1. 11.x core/modules/views/tests/src/Kernel/Plugin/StyleTestBase.php \Drupal\Tests\views\Kernel\Plugin\StyleTestBase

Tests some general style plugin related functionality.

Hierarchy

Expanded class hierarchy of StyleTestBase

File

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

Namespace

Drupal\Tests\views\Kernel\Plugin
View source
abstract class StyleTestBase extends ViewsKernelTestBase {
  
  /**
   * Stores the SimpleXML representation of the output.
   *
   * @var \SimpleXMLElement
   */
  protected $elements;
  
  /**
   * Stores a view output in the elements.
   */
  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.