/** * @test * @return void */ public function cleanupCommandHandlesExpiredRegistrationsAndCleansCacheTest() { // Inject configuration and configurationManager $configuration = array('plugin.' => array('tx_sfeventmgt.' => array('settings.' => array('clearCacheUids' => '1,2,3', 'registration.' => array('deleteExpiredRegistrations' => 0))))); $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); $registrationService = $this->getMock('DERHANSEN\\SfEventMgt\\Service\\RegistrationService', array('handleExpiredRegistrations'), array(), '', FALSE); $registrationService->expects($this->once())->method('handleExpiredRegistrations')->with(0)->will($this->returnValue($configuration)); $this->inject($this->subject, 'registrationService', $registrationService); $cacheService = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager', array('clearPageCache'), array(), '', FALSE); $cacheService->expects($this->once())->method('clearPageCache')->with(array(1, 2, 3)); $this->inject($this->subject, 'cacheService', $cacheService); $this->subject->cleanupCommand(); }
/** * @test * @return void */ public function cleanupCommandHandlesExpiredRegistrationsAndCleansCacheTest() { // Inject configuration and configurationManager $configuration = ['plugin.' => ['tx_sfeventmgt.' => ['settings.' => ['clearCacheUids' => '1,2,3', 'registration.' => ['deleteExpiredRegistrations' => 0]]]]]; $configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager', ['getConfiguration'], [], '', false); $configurationManager->expects($this->once())->method('getConfiguration')->will($this->returnValue($configuration)); $this->inject($this->subject, 'configurationManager', $configurationManager); $registrationService = $this->getMock('DERHANSEN\\SfEventMgt\\Service\\RegistrationService', ['handleExpiredRegistrations'], [], '', false); $registrationService->expects($this->once())->method('handleExpiredRegistrations')->with(0)->will($this->returnValue($configuration)); $this->inject($this->subject, 'registrationService', $registrationService); $utilityService = $this->getMock('DERHANSEN\\SfEventMgt\\Service\\UtilityService', ['clearCacheForConfiguredUids'], [], '', false); $utilityService->expects($this->once())->method('clearCacheForConfiguredUids')->with($configuration['plugin.']['tx_sfeventmgt.']['settings.']); $this->inject($this->subject, 'utilityService', $utilityService); $this->subject->cleanupCommand(); }