function ViewAjaxControllerTest::testAccessDeniedView
Same name in other branches
- 9 core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::testAccessDeniedView()
- 8.9.x core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::testAccessDeniedView()
- 10 core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::testAccessDeniedView()
Tests a view without having access to it.
File
-
core/
modules/ views/ tests/ src/ Unit/ Controller/ ViewAjaxControllerTest.php, line 156
Class
- ViewAjaxControllerTest
- @coversDefaultClass \Drupal\views\Controller\ViewAjaxController @group views
Namespace
Drupal\Tests\views\Unit\ControllerCode
public function testAccessDeniedView() : void {
$request = new Request();
$request->request
->set('view_name', 'test_view');
$request->request
->set('view_display_id', 'page_1');
$view = $this->getMockBuilder('Drupal\\views\\Entity\\View')
->disableOriginalConstructor()
->getMock();
$this->viewStorage
->expects($this->once())
->method('load')
->with('test_view')
->willReturn($view);
$executable = $this->getMockBuilder('Drupal\\views\\ViewExecutable')
->disableOriginalConstructor()
->getMock();
$executable->expects($this->once())
->method('access')
->willReturn(FALSE);
$this->executableFactory
->expects($this->once())
->method('get')
->with($view)
->willReturn($executable);
$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.