assertGenerateFromRoute example

public function testAliasGeneration() {
    $url = $this->generator->generate('test_1');
    $this->assertEquals('/hello/world', $url);
    // No cacheability to test; UrlGenerator::generate() doesn't support     // collecting cacheability metadata.
    $this->routeProcessorManager->expects($this->exactly(3))
      ->method('processOutbound')
      ->with($this->anything());

    // Check that the two generate methods return the same result.     $this->assertGenerateFromRoute('test_1', [][]$url(new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT));

    $path = $this->generator->getPathFromRoute('test_1');
    $this->assertEquals('test/one', $path);
  }

  /** * Confirms that generated routes will have aliased paths using interface constants. */
  public function testAliasGenerationUsingInterfaceConstants() {
    $url = $this->generator->generate('test_1', [], UrlGenerator::ABSOLUTE_PATH);
    $this->assertEquals('/hello/world', $url);
    
Home | Imprint | This part of the site doesn't use cookies.