StyleTestBase.php

Same filename and directory in other branches
  1. 9 core/modules/views/tests/src/Kernel/Plugin/StyleTestBase.php
  2. 8.9.x core/modules/views/tests/src/Kernel/Plugin/StyleTestBase.php
  3. 11.x core/modules/views/tests/src/Kernel/Plugin/StyleTestBase.php

Namespace

Drupal\Tests\views\Kernel\Plugin

File

core/modules/views/tests/src/Kernel/Plugin/StyleTestBase.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\views\Kernel\Plugin;

use Drupal\Component\Utility\Html;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;

/**
 * Tests some general style plugin related functionality.
 */
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) {
    $htmlDom = Html::load($output);
    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);
    }
  }

}

Classes

Title Deprecated Summary
StyleTestBase Tests some general style plugin related functionality.

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