/** * We have the same situation as before but in this * testcase we test the visibility of page c and change * the pid afterward. Because the visibility is forced * to no by inheritance, it should normaly be visible, * but the result of the visibility is chached in * that situation and the visibility will only change afterwards * when the cache was flushed. * * @param void * @return void * @author Timo Schmidt <*****@*****.**> * @test */ public function changeOfPidDoesNotInfluenceCachedResult() { $cacheManager = tx_languagevisibility_cacheManager::getInstance(); $isCacheEnabled = $cacheManager->isCacheEnabled(); $this->assertTrue($isCacheEnabled, 'Cache needs to be enabled to perform this test'); $this->importDataSet(dirname(__FILE__) . '/fixtures/canDetermineInheritedVisibility.xml'); $fixtureLanguageRow = array('uid' => 1, 'tx_languagevisibility_defaultvisibility' => 't'); $fixtureLanguage = new tx_languagevisibility_language(); $fixtureLanguage->setData($fixtureLanguageRow); $dao = new tx_languagevisibility_daocommon(); $elementFactory = new tx_languagevisibility_elementFactory($dao); $fixtureElement = $elementFactory->getElementForTable('pages', 3); $visibilityService = new tx_languagevisibility_visibilityService(); $visibilityResult = true; $visibilityResult = $visibilityService->isVisible($fixtureLanguage, $fixtureElement); $this->assertFalse($visibilityResult, 'The element should not be visibile because of the inherited force to no setting'); $db = $GLOBALS['TYPO3_DB']; /* @var $db t3lib_db */ $db->exec_UPDATEquery('pages', 'pid=2', array('pid' => 0)); $visibilityResult = $visibilityService->isVisible($fixtureLanguage, $fixtureElement); $this->assertFalse($visibilityResult, 'The element should not still not be visible because the visibility result is cached'); tx_languagevisibility_cacheManager::getInstance()->flushAllCaches(); $visibilityResult = $visibilityService->isVisible($fixtureLanguage, $fixtureElement); $this->assertTrue($visibilityResult, 'Now the element should be visible because the cache was flushed'); }
/** * * @test * @return void */ public function getIsoCode() { // Create the Array fixture. $fixture = array('uid' => 1, 'static_lang_isocode' => '49'); $language = new tx_languagevisibility_language(); $language->setData($fixture); // Assert that the size of the Array fixture is 0. $this->assertEquals('HE', $language->getIsoCode(), "wrong getIsoCode"); }
function _fixture_getLanguageFourWithElementFallback() { $fixture = array('uid' => 2, 'tx_languagevisibility_fallbackorder' => '0,1', 'tx_languagevisibility_fallbackorderel' => '1', 'tx_languagevisibility_defaultvisibility' => 'f', 'tx_languagevisibility_defaultvisibilityel' => 'f'); $language4 = new tx_languagevisibility_language(); $language4->setData($fixture); return $language4; }