/** * Adds page cache tags by used storagePages. * This adds tags with the scheme tx_news_pid_[news:pid] * * @param Tx_News_Domain_Model_Dto_NewsDemand $demand * @return void */ public static function addPageCacheTagsByDemandObject(Tx_News_Domain_Model_Dto_NewsDemand $demand) { $cacheTags = array(); if ($demand->getStoragePage()) { // Add cache tags for each storage page foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $demand->getStoragePage()) as $pageId) { $cacheTags[] = 'tx_news_pid_' . $pageId; } } if (count($cacheTags) > 0) { $GLOBALS['TSFE']->addCacheTags($cacheTags); } }
/** * @test * @return void */ public function excludeAlreadyDisplayedNewsCanBeSet() { $value = TRUE; $this->instance->setExcludeAlreadyDisplayedNews($value); $this->assertEquals($value, $this->instance->getExcludeAlreadyDisplayedNews()); }
/** * Test if isDummyRecord can be set * * @test * @return void */ public function isDummyRecordCanBeSet() { $domainModelInstance = new Tx_News_Domain_Model_Dto_NewsDemand(); $isDummyRecord = TRUE; $domainModelInstance->setIsDummyRecord($isDummyRecord); $this->assertEquals($isDummyRecord, $domainModelInstance->getIsDummyRecord()); }
/** * @test */ public function constraintsAreReturnedForDateFields() { $mockedQuery = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface'); $mockedRepository = $this->getAccessibleMock('Tx_News_Domain_Repository_NewsRepository', array('dummy'), array(), '', FALSE); $search = new Tx_News_Domain_Model_Dto_Search(); $search->setMinimumDate('2014-01-01'); $search->setDateField('datetime'); $demand = new Tx_News_Domain_Model_Dto_NewsDemand(); $demand->setSearch($search); $result = $mockedRepository->_call('getSearchConstraints', $mockedQuery, $demand); $this->assertEquals(1, count($result)); $search->setMaximumDate('2015-01-01'); $demand->setSearch($search); $result = $mockedRepository->_call('getSearchConstraints', $mockedQuery, $demand); $this->assertEquals(2, count($result)); $search->setMaximumDate('xyz'); $demand->setSearch($search); $result = $mockedRepository->_call('getSearchConstraints', $mockedQuery, $demand); $this->assertEquals(1, count($result)); }