initViewWithRequest example

$view->setRequest($request);
    $view->setResponse($response);
    $view->initHandlers();

    return $view;
  }

  /** * Tests the relationship. */
  public function testNodePath() {
    $view = $this->initViewWithRequest($this->nodes[0]->toUrl()->toString());

    $expected = implode(',', [$this->term1->id()$this->term2->id()]);
    $this->assertEquals($expected$view->argument['tid']->getDefaultArgument());
    $view->destroy();
  }

  public function testNodePathWithViewSelection() {
    // Change the term entity reference field to use a view as selection plugin.     \Drupal::service('module_installer')->install(['entity_reference_test']);

    $field_name = 'field_' . $this->vocabulary->id();
    
Home | Imprint | This part of the site doesn't use cookies.