/** * @test * @return void */ public function getiCalendarContentAssignsVariablesToView() { $_SERVER['HTTP_HOST'] = 'myhostname.tld'; $mockEvent = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Model\\Event', [], [], '', false); $iCalendarView = $this->getMock('TYPO3\\CMS\\Fluid\\View\\StandaloneView', [], [], '', false); $iCalendarView->expects($this->once())->method('setFormat')->with('txt'); $iCalendarView->expects($this->once())->method('assignMultiple')->with(['event' => $mockEvent, 'typo3Host' => 'myhostname.tld']); $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', [], [], '', false); $objectManager->expects($this->once())->method('get')->will($this->returnValue($iCalendarView)); $this->inject($this->subject, 'objectManager', $objectManager); $fluidStandaloneService = $this->getMock('DERHANSEN\\SfEventMgt\\Service\\FluidStandaloneService', [], [], '', false); $fluidStandaloneService->expects($this->any())->method('getTemplateFolders')->will($this->returnValue([])); $this->inject($this->subject, 'fluidStandaloneService', $fluidStandaloneService); $this->subject->getiCalendarContent($mockEvent); }
/** * @test * @return void */ public function getiCalendarContentAssignsVariablesToView() { $_SERVER['HTTP_HOST'] = 'myhostname.tld'; $mockEvent = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Model\\Event', array(), array(), '', FALSE); // Inject configuration and configurationManager $configuration = array('plugin.' => array('tx_sfeventmgt.' => array('view.' => array('templateRootPath' => 'EXT:sf_event_mgt/Resources/Private/Templates/', 'layoutRootPath' => 'EXT:sf_event_mgt/Resources/Private/Layouts/')))); $configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager', array('getConfiguration'), array(), '', FALSE); $configurationManager->expects($this->once())->method('getConfiguration')->will($this->returnValue($configuration)); $this->inject($this->subject, 'configurationManager', $configurationManager); $iCalendarView = $this->getMock('TYPO3\\CMS\\Fluid\\View\\StandaloneView', array(), array(), '', FALSE); $iCalendarView->expects($this->once())->method('setFormat')->with('txt'); $iCalendarView->expects($this->once())->method('assignMultiple')->with(array('event' => $mockEvent, 'typo3Host' => 'myhostname.tld')); $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', array(), array(), '', FALSE); $objectManager->expects($this->once())->method('get')->will($this->returnValue($iCalendarView)); $this->inject($this->subject, 'objectManager', $objectManager); $this->subject->getiCalendarContent($mockEvent); }
/** * Initiates the iCalendar download for the given event * * @param Event $event The event * * @return bool */ public function icalDownloadAction(Event $event) { $this->icalendarService->downloadiCalendarFile($event); return false; }