You are here

public function ViewAjaxControllerTest::testMissingView in Drupal 8

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()

Tests with view_name and view_display_id but not existing view.

File

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

Class

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

Namespace

Drupal\Tests\views\Unit\Controller

Code

public function testMissingView() {
  $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')
    ->will($this
    ->returnValue(FALSE));
  $this
    ->expectException(NotFoundHttpException::class);
  $this->viewAjaxController
    ->ajaxView($request);
}