setupValidMocks example


  public function testAjaxView() {
    $request = new Request();
    $request->query->set('view_name', 'test_view');
    $request->query->set('view_display_id', 'page_1');
    $request->query->set('view_path', '/test-page');
    $request->query->set('_wrapper_format', 'ajax');
    $request->query->set('ajax_page_state', 'drupal.settings[]');
    $request->query->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);

    
Home | Imprint | This part of the site doesn't use cookies.