function ViewAjaxControllerTest::testAjaxViewWithoutAjax

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::testAjaxViewWithoutAjax()
  2. 8.9.x core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::testAjaxViewWithoutAjax()
  3. 11.x core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::testAjaxViewWithoutAjax()

Tests a valid view without ajax enabled.

File

core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php, line 254

Class

ViewAjaxControllerTest
@coversDefaultClass \Drupal\views\Controller\ViewAjaxController @group views

Namespace

Drupal\Tests\views\Unit\Controller

Code

public function testAjaxViewWithoutAjax() : void {
    $request = new Request();
    $request->request
        ->set('view_name', 'test_view');
    $request->request
        ->set('view_display_id', 'page_1');
    $request->request
        ->set('view_path', '/test-page');
    $request->request
        ->set('_wrapper_format', 'ajax');
    $request->request
        ->set('ajax_page_state', 'drupal.settings[]');
    $request->request
        ->set('type', 'article');
    $this->setupValidMocks(static::USE_NO_AJAX);
    $this->expectException(AccessDeniedHttpException::class);
    $this->viewAjaxController
        ->ajaxView($request);
}

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