/** * @test */ public function executeDoesNotCallCollectGarbageOfNotConfiguredBackend() { $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array(), array(), '', false); $cache->expects($this->any())->method('getIdentifier')->will($this->returnValue('cache')); $cache->expects($this->never())->method('collectGarbage'); $mockCacheManager = new \TYPO3\CMS\Core\Cache\CacheManager(); $mockCacheManager->registerCache($cache); GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Cache\CacheManager::class, $mockCacheManager); $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] = array('cache' => array('frontend' => \TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, 'backend' => \TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)); /** @var \TYPO3\CMS\Scheduler\Task\CachingFrameworkGarbageCollectionTask|\PHPUnit_Framework_MockObject_MockObject $subject */ $subject = $this->getMock(\TYPO3\CMS\Scheduler\Task\CachingFrameworkGarbageCollectionTask::class, array('dummy'), array(), '', false); $subject->selectedBackends = array(\TYPO3\CMS\Core\Cache\Backend\NullBackend::class); $subject->execute(); }
/** * @test */ public function flushCachesCallsTheFlushMethodOfAllRegisteredCaches() { $manager = new \TYPO3\CMS\Core\Cache\CacheManager(); $cache1 = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', FALSE); $cache1->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('cache1')); $cache1->expects($this->once())->method('flush'); $manager->registerCache($cache1); $cache2 = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', FALSE); $cache2->expects($this->once())->method('flush'); $manager->registerCache($cache2); $manager->flushCaches(); }
function renderTimeTracking() { $mainFunction = $this->getMainFunction(); t3lib_befunc::setMainFunction($mainFunction); $pageByMenu = array_flip($this->pi1->menuByPage); $activeMenuID = $pageByMenu[$this->getActiveMenu()]; $this->pi1->tsfe->id = $activeMenuID; $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_Cache\\Frontend\\VariableFrontend.php']['set'] = NULL; $GLOBALS['LANG'] = NULL; $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['parser']['xml'] = \TYPO3\CMS\Core\Localization\Parser\LocallangXmlParser::class; $be = new \TYPO3\CMS\Core\Cache\Backend\NullBackend('context'); $fe = new \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('t3lib_l10n', $be); $cm = new \TYPO3\CMS\Core\Cache\CacheManager(); $cm->registerCache($fe); $GLOBALS['typo3CacheManager'] = $cm; $content[] = $this->pi1->main('', array()); $html = new View('template/template.phtml'); $html->title = 'Rechnung+ 2.0'; $html->headerData = implode("\n", $this->pi1->tsfe->additionalHeaderData); $html->content = implode("\n", $content); $html->h1 = $this->pi1->menuOptions[$this->getActiveMenu()]; $html->h2 = $mainFunction; $html->activeMenu = $this->pi1->tsfe->id; $html->userSelection = $this->getUserSelection(); $html->countUsers = sizeof($this->pi1->getFEUserChoice()); $html->clientCount = $this->pi1->clients; $html->projectCount = $this->pi1->projects; $html->invoiceCount = $this->pi1->invoices; $html->workCount = $this->pi1->works; $html->groupCount = 0; return $html; }