public function ViewAjaxControllerTest::testAjaxViewWithArguments in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::testAjaxViewWithArguments()
Tests a valid view with arguments.
File
- core/
modules/ views/ tests/ src/ Unit/ Controller/ ViewAjaxControllerTest.php, line 258
Class
- ViewAjaxControllerTest
- @coversDefaultClass \Drupal\views\Controller\ViewAjaxController @group views
Namespace
Drupal\Tests\views\Unit\ControllerCode
public function testAjaxViewWithArguments() {
$request = new Request();
$request->request
->set('view_name', 'test_view');
$request->request
->set('view_display_id', 'page_1');
$request->request
->set('view_args', 'arg1/arg2');
list($view, $executable) = $this
->setupValidMocks();
$executable
->expects($this
->once())
->method('preview')
->with('page_1', [
'arg1',
'arg2',
]);
$response = $this->viewAjaxController
->ajaxView($request);
$this
->assertInstanceOf(ViewAjaxResponse::class, $response);
$this
->assertViewResultCommand($response);
}