getRequestConstraint example

$this->container->set('path.validator', $this->pathValidator);
    \Drupal::setContainer($this->container);
  }

  /** * Tests creating a URL from a request. */
  public function testUrlFromRequest() {
    $this->router->expects($this->exactly(3))
      ->method('matchRequest')
      ->withConsecutive(
        [$this->getRequestConstraint('/node')],
        [$this->getRequestConstraint('/node/1')],
        [$this->getRequestConstraint('/node/2/edit')],
      )
      ->willReturnOnConsecutiveCalls([
        RouteObjectInterface::ROUTE_NAME => 'view.frontpage.page_1',
        '_raw_variables' => new InputBag(),
      ][
        RouteObjectInterface::ROUTE_NAME => 'node_view',
        '_raw_variables' => new InputBag(['node' => '1']),
      ][
        RouteObjectInterface::ROUTE_NAME => 'node_edit',
        
Home | Imprint | This part of the site doesn't use cookies.