function ViewTestBase::executeView

Same name in this branch
  1. 8.9.x core/modules/views/src/Tests/ViewTestBase.php \Drupal\views\Tests\ViewTestBase::executeView()
Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/ViewTestBase.php \Drupal\Tests\views\Functional\ViewTestBase::executeView()
  2. 10 core/modules/views/tests/src/Functional/ViewTestBase.php \Drupal\Tests\views\Functional\ViewTestBase::executeView()
  3. 11.x 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.

42 calls to ViewTestBase::executeView()
ArgumentDefaultTest::testArgumentDefaultPlugin in core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php
Tests the argument default test plugin.
CustomBooleanTest::testCustomOption in core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php
Tests the setting and output of custom labels for boolean values.
CustomBooleanTest::testCustomOptionTemplate in core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php
Tests the setting and output of custom labels for boolean values.
DefaultViewRecentCommentsTest::testBlockDisplay in core/modules/comment/tests/src/Functional/Views/DefaultViewRecentCommentsTest.php
Tests the block defined by the comments_recent view.
DefaultViewsTest::testArchiveView in core/modules/views/tests/src/Functional/DefaultViewsTest.php
Tests the archive view.

... See full list

File

core/modules/views/tests/src/Functional/ViewTestBase.php, line 125

Class

ViewTestBase
Defines a base class for Views testing in the full web test environment.

Namespace

Drupal\Tests\views\Functional

Code

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);
}

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