17 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
34 protected function setUp()
36 $this->cacheService = new \TYPO3\CMS\Extbase\Service\CacheService();
37 $this->cacheManagerMock = $this->createMock(\
TYPO3\CMS\Core\Cache\CacheManager::class);
38 $this->cacheService->injectCacheManager($this->cacheManagerMock);
46 $this->cacheManagerMock->expects($this->once())->method(
'flushCachesInGroupByTags')->with(
'pages', [
'pageId_123']);
47 $this->cacheService->clearPageCache(123);
55 $this->cacheManagerMock->expects($this->once())->method(
'flushCachesInGroupByTags')->with(
'pages', [
'pageId_0']);
56 $this->cacheService->clearPageCache(
'Foo');
64 $this->cacheManagerMock->expects($this->once())->method(
'flushCachesInGroup')->with(
'pages');
65 $this->cacheService->clearPageCache();
73 $this->cacheManagerMock->expects($this->at(0))->method(
'flushCachesInGroupByTags')->with(
'pages', [
'pageId_1',
'pageId_2',
'pageId_3']);
74 $this->cacheService->clearPageCache([1, 2, 3]);
82 $this->cacheManagerMock->expects($this->at(0))->method(
'flushCachesInGroupByTags')->with(
'pages', [
'pageId_2',
'pageId_15',
'pageId_8']);
84 $this->cacheService->getPageIdStack()->push(8);
85 $this->cacheService->getPageIdStack()->push(15);
86 $this->cacheService->getPageIdStack()->push(2);
88 $this->cacheService->clearCachesOfRegisteredPageIds();
96 $this->cacheManagerMock->expects($this->at(0))->method(
'flushCachesInGroupByTags')->with(
'pages', [
'pageId_2',
'pageId_15',
'pageId_8']);
98 $this->cacheService->getPageIdStack()->push(8);
99 $this->cacheService->getPageIdStack()->push(15);
100 $this->cacheService->getPageIdStack()->push(15);
101 $this->cacheService->getPageIdStack()->push(2);
102 $this->cacheService->getPageIdStack()->push(2);
104 $this->cacheService->clearCachesOfRegisteredPageIds();