public function testDownloadNameOverrideWorks() { $content = $this->getCompleteContent(); $routeReference = new RouteReference(ContentDownloadRouteReferenceListener::ROUTE_NAME, [ContentDownloadRouteReferenceListener::OPT_CONTENT => $content, ContentDownloadRouteReferenceListener::OPT_FIELD_IDENTIFIER => 'file', ContentDownloadRouteReferenceListener::OPT_DOWNLOAD_NAME => 'My-custom-filename.pdf']); $event = new RouteReferenceGenerationEvent($routeReference, new Request()); $eventListener = $this->getListener(); $eventListener->onRouteReferenceGeneration($event); self::assertEquals('My-custom-filename.pdf', $routeReference->get(ContentDownloadRouteReferenceListener::OPT_DOWNLOAD_NAME)); }
public function testOnRouteReferenceGenerationNoTranslationSiteAccess() { $language = 'fre-FR'; $routeReference = new RouteReference('foo', array('language' => $language)); $event = new RouteReferenceGenerationEvent($routeReference, new Request()); $this->translationHelper->expects($this->once())->method('getTranslationSiteAccess')->with($language)->will($this->returnValue(null)); $listener = new LanguageSwitchListener($this->translationHelper); $listener->onRouteReferenceGeneration($event); $this->assertFalse($routeReference->has('language')); $this->assertFalse($routeReference->has('siteaccess')); }
public function testRemoveParam() { $reference = new RouteReference('foo'); $reference->set('foo', 'bar'); $this->assertTrue($reference->has('foo')); $this->assertSame('bar', $reference->get('foo')); $reference->remove('foo'); $this->assertFalse($reference->has('foo')); }