/**
  * @covers Kunstmaan\NodeBundle\Router\SlugRouter::generate
  * @covers Kunstmaan\NodeBundle\Router\SlugRouter::getRouteCollection
  * @covers Kunstmaan\NodeBundle\Router\SlugRouter::getContext
  */
 public function testGenerateSingleLanguage()
 {
     $request = $this->getRequest();
     $container = $this->getContainer($request);
     $object = new SlugRouter($container);
     $url = $object->generate('_slug', array('url' => 'some-uri', '_locale' => 'nl'), true);
     $this->assertEquals('http://domain.tld/some-uri', $url);
     $url = $object->generate('_slug', array('url' => 'some-uri', '_locale' => 'nl'), false);
     $this->assertEquals('/some-uri', $url);
 }
 /**
  * Generate an url for a supplied route
  *
  * @param string $name       The path
  * @param array  $parameters The route parameters
  * @param bool   $absolute   Absolute url or not
  *
  * @return null|string
  */
 public function generate($name, $parameters = array(), $absolute = false)
 {
     if ('_slug' === $name) {
         if ($this->isMultiLanguage() && $this->isMultiDomainHost()) {
             $locale = isset($parameters['_locale']) ? $parameters['_locale'] : $this->getRequestLocale();
             $reverseLocaleMap = $this->getReverseLocaleMap();
             if (isset($reverseLocaleMap[$locale])) {
                 $parameters['_locale'] = $reverseLocaleMap[$locale];
             }
         }
     }
     return parent::generate($name, $parameters, $absolute);
 }
 /**
  * Generate an url for a supplied route
  *
  * @param string   $name          The path
  * @param array    $parameters    The route parameters
  * @param int|bool $referenceType The type of reference to be generated (one of the UrlGeneratorInterface constants)
  *
  * @return null|string
  */
 public function generate($name, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
 {
     if ('_slug' === $name) {
         if ($this->isMultiLanguage() && $this->isMultiDomainHost()) {
             $locale = isset($parameters['_locale']) ? $parameters['_locale'] : $this->getRequestLocale();
             $reverseLocaleMap = $this->getReverseLocaleMap();
             if (isset($reverseLocaleMap[$locale])) {
                 $parameters['_locale'] = $reverseLocaleMap[$locale];
             }
         }
     }
     return parent::generate($name, $parameters, $referenceType);
 }