|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Christian Kuhn <lolli@schwarzbu.ch> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * 00017 * This script is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * This copyright notice MUST APPEAR in all copies of the script! 00023 ***************************************************************/ 00024 00025 /** 00026 * Testcase for class "tx_scheduler_CachingFrameworkGarbageCollection" 00027 * 00028 * @package TYPO3 00029 * @subpackage tx_scheduler 00030 * 00031 * @author Christian Kuhn <lolli@schwarzbu.ch> 00032 */ 00033 class tx_scheduler_CachingFrameworkGarbageCollectionTest extends tx_phpunit_testcase { 00034 protected $backupGlobals = TRUE; 00035 00036 /** 00037 * @test 00038 */ 00039 public function executeCallsCollectGarbageOfConfiguredBackend() { 00040 $cache = $this->getMock('t3lib_cache_frontend_StringFrontend', array(), array(), '', FALSE); 00041 $cache->expects($this->any())->method('getIdentifier')->will($this->returnValue('cache')); 00042 00043 $cache->expects($this->atLeastOnce())->method('collectGarbage'); 00044 00045 $GLOBALS['typo3CacheManager'] = new t3lib_cache_Manager(); 00046 $GLOBALS['typo3CacheManager']->registerCache($cache); 00047 $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] = array( 00048 'cache' => array( 00049 'frontend' => 't3lib_cache_frontend_StringFrontend', 00050 'backend' => 't3lib_cache_backend_AbstractBackend', 00051 ), 00052 ); 00053 00054 $task = new tx_scheduler_CachingFrameworkGarbageCollection(); 00055 $task->selectedBackends = array('t3lib_cache_backend_AbstractBackend'); 00056 $task->execute(); 00057 } 00058 00059 /** 00060 * @test 00061 */ 00062 public function executeDoesNotCallCollectGarbageOfConfiguredBackend() { 00063 $cache = $this->getMock('t3lib_cache_frontend_StringFrontend', array(), array(), '', FALSE); 00064 $cache->expects($this->any())->method('getIdentifier')->will($this->returnValue('cache')); 00065 00066 $cache->expects($this->never())->method('collectGarbage'); 00067 00068 $GLOBALS['typo3CacheManager'] = new t3lib_cache_Manager(); 00069 $GLOBALS['typo3CacheManager']->registerCache($cache); 00070 $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] = array( 00071 'cache' => array( 00072 'frontend' => 't3lib_cache_frontend_StringFrontend', 00073 'backend' => 't3lib_cache_backend_AbstractBackend', 00074 ), 00075 ); 00076 00077 $task = new tx_scheduler_CachingFrameworkGarbageCollection(); 00078 $task->selectedBackends = array('t3lib_cache_backend_NullBackend'); 00079 $task->execute(); 00080 } 00081 } 00082 ?>
1.8.0