function ViewAjaxControllerTest::testAjaxView
Same name in other branches
- 8.9.x core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::testAjaxView()
- 10 core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::testAjaxView()
- 11.x core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::testAjaxView()
Tests a valid view without arguments pagers etc.
File
-
core/
modules/ views/ tests/ src/ Unit/ Controller/ ViewAjaxControllerTest.php, line 183
Class
- ViewAjaxControllerTest
- @coversDefaultClass \Drupal\views\Controller\ViewAjaxController @group views
Namespace
Drupal\Tests\views\Unit\ControllerCode
public function testAjaxView() {
$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');
[
$view,
$executable,
] = $this->setupValidMocks();
$this->redirectDestination
->expects($this->atLeastOnce())
->method('set')
->with('/test-page?type=article');
$this->currentPath
->expects($this->once())
->method('setPath')
->with('/test-page', $request);
$response = $this->viewAjaxController
->ajaxView($request);
$this->assertTrue($response instanceof ViewAjaxResponse);
$this->assertSame($response->getView(), $executable);
$this->assertViewResultCommand($response);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.