function ViewAjaxControllerTest::testMissingView

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

Tests non-existent view with view_name and view_display_id.

File

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

Class

ViewAjaxControllerTest
@coversDefaultClass \Drupal\views\Controller\ViewAjaxController[[api-linebreak]] @group views

Namespace

Drupal\Tests\views\Unit\Controller

Code

public function testMissingView() : void {
  $request = new Request();
  $request->request
    ->set('view_name', 'test_view');
  $request->request
    ->set('view_display_id', 'page_1');
  $this->viewStorage
    ->expects($this->once())
    ->method('load')
    ->with('test_view')
    ->willReturn(FALSE);
  $this->expectException(NotFoundHttpException::class);
  $this->viewAjaxController
    ->ajaxView($request);
}

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