You are here

protected function ViewKernelTestBase::executeView in Drupal 8

Executes a view with debugging.

Parameters

\Drupal\views\ViewExecutable $view: The view object.

array $args: (optional) An array of the view arguments to use for the view.

File

core/modules/views/src/Tests/ViewKernelTestBase.php, line 125

Class

ViewKernelTestBase
Defines a base class for Views unit testing.

Namespace

Drupal\views\Tests

Code

protected function executeView($view, array $args = []) {
  $view
    ->setDisplay();
  $view
    ->preExecute($args);
  $view
    ->execute();
  $verbose_message = '<pre>Executed view: ' . (string) $view->build_info['query'] . '</pre>';
  if ($view->build_info['query'] instanceof SelectInterface) {
    $verbose_message .= '<pre>Arguments: ' . print_r($view->build_info['query']
      ->getArguments(), TRUE) . '</pre>';
  }
  $this
    ->verbose($verbose_message);
}