Symfony\Component\Routing\Generator\UrlGenerator::setContext PHP Method

setContext() public method

Sets the request context.
public setContext ( Symfony\Component\Routing\RequestContext $context )
$context Symfony\Component\Routing\RequestContext The context
    public function setContext(RequestContext $context)
    {
        $this->context = $context;
    }

Usage Example

 public function testAbsoluteUrlWithExtraParameters()
 {
     $this->routeCollection->add('test', new Route('/testing'));
     $this->generator->setContext(array('base_url' => '/app.php', 'method' => 'GET', 'host' => 'localhost', 'port' => 80, 'is_secure' => false));
     $url = $this->generator->generate('test', array('foo' => 'bar'), true);
     $this->assertEquals('http://localhost/app.php/testing?foo=bar', $url);
 }
All Usage Examples Of Symfony\Component\Routing\Generator\UrlGenerator::setContext