You are here

public function ViewAjaxControllerTest::testAjaxViewWithEmptyArguments in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::testAjaxViewWithEmptyArguments()

Tests a valid view with arguments.

File

core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php, line 239
Contains \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest.

Class

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

Namespace

Drupal\Tests\views\Unit\Controller

Code

public function testAjaxViewWithEmptyArguments() {
  $request = new Request();
  $request->request
    ->set('view_name', 'test_view');
  $request->request
    ->set('view_display_id', 'page_1');

  // Simulate a request that has a second, empty argument.
  $request->request
    ->set('view_args', 'arg1/');
  list($view, $executable) = $this
    ->setupValidMocks();
  $executable
    ->expects($this
    ->once())
    ->method('preview')
    ->with('page_1', $this
    ->identicalTo(array(
    'arg1',
    NULL,
  )));
  $response = $this->viewAjaxController
    ->ajaxView($request);
  $this
    ->assertTrue($response instanceof ViewAjaxResponse);
  $this
    ->assertViewResultCommand($response);
}