protected function ViewTestBase::executeView in Drupal 8
Same name in this branch
- 8 core/modules/views/src/Tests/ViewTestBase.php \Drupal\views\Tests\ViewTestBase::executeView()
- 8 core/modules/views/tests/src/Functional/ViewTestBase.php \Drupal\Tests\views\Functional\ViewTestBase::executeView()
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/ ViewTestBase.php, line 121
Class
- ViewTestBase
- Defines a base class for Views testing in the full web test environment.
Namespace
Drupal\views\TestsCode
protected function executeView(ViewExecutable $view, $args = []) {
// A view does not really work outside of a request scope, due to many
// dependencies like the current user.
$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);
}