/** * @test */ public function instantiateAnotherProxyAndSetValueNotAffectsThisFixture() { $otherConfiguration = Tx_Oelib_ConfigurationProxy::getInstance('other_extension'); $otherConfiguration->setAsString('testValue', 'foo'); self::assertSame('foo', $otherConfiguration->getAsString('testValue')); self::assertSame($this->testConfiguration, $this->subject->getCompleteConfiguration()); }
/** * @test */ public function configurationCheckCreationForDisabledConfigurationCeck() { Tx_Oelib_ConfigurationProxy::getInstance('oelib')->setAsBoolean('enableConfigCheck', FALSE); $subject = new Tx_Oelib_Tests_Unit_Fixtures_TestingTemplateHelper(); $result = $subject->getConfigurationCheck(); self::assertNull($result); }
protected function setUp() { $configurationRegistry = Tx_Oelib_ConfigurationRegistry::getInstance(); $configurationRegistry->set('config', new Tx_Oelib_Configuration()); $configurationRegistry->set('page.config', new Tx_Oelib_Configuration()); $configurationRegistry->set('plugin.tx_seminars._LOCAL_LANG.default', new Tx_Oelib_Configuration()); Tx_Oelib_ConfigurationProxy::getInstance('seminars')->setAsBoolean('enableConfigCheck', FALSE); $this->testingFramework = new Tx_Oelib_TestingFramework('tx_seminars'); $this->testingFramework->createFakeFrontEnd(); $this->mapper = $this->getMock('tx_seminars_Mapper_Event', array('findNextUpcoming')); $this->fixture = new tx_seminars_FrontEnd_Countdown(array('isStaticTemplateLoaded' => 1, 'templateFile' => 'EXT:seminars/Resources/Private/Templates/FrontEnd/FrontEnd.html'), $GLOBALS['TSFE']->cObj); }
/** * Cleans up oelib after running a test. * * @return void */ public function cleanUp() { Tx_Oelib_ConfigurationProxy::purgeInstances(); Tx_Oelib_BackEndLoginManager::purgeInstance(); Tx_Oelib_ConfigurationRegistry::purgeInstance(); Tx_Oelib_FrontEndLoginManager::purgeInstance(); tx_oelib_Geocoding_Google::purgeInstance(); tx_oelib_headerProxyFactory::purgeInstance(); Tx_Oelib_MapperRegistry::purgeInstance(); Tx_Oelib_PageFinder::purgeInstance(); Tx_Oelib_Session::purgeInstances(); Tx_Oelib_TemplateHelper::purgeCachedConfigurations(); Tx_Oelib_TranslatorRegistry::purgeInstance(); /** @var Tx_Oelib_MailerFactory $mailerFactory */ $mailerFactory = t3lib_div::makeInstance('Tx_Oelib_MailerFactory'); $mailerFactory->cleanUp(); }
/** * Initializes the FE plugin stuff and reads the configuration. * * It is harmless if this function gets called multiple times as it * recognizes this and ignores all calls but the first one. * * This is merely a convenience function. * * If the parameter is omitted, the configuration for plugin.tx_[extkey] is * used instead, e.g. plugin.tx_seminars. * * @param array|NULL $configuration TypoScript configuration for the plugin, set to NULL to load the configuration from a BE page * * @return void */ public function init(array $configuration = NULL) { if ($this->isInitialized) { return; } $frontEnd = $this->getFrontEndController(); if ($frontEnd !== NULL && !isset($frontEnd->config['config'])) { $frontEnd->config['config'] = array(); } // Calls the base class's constructor manually as this isn't done automatically. parent::__construct(); if ($configuration !== NULL) { $this->conf = $configuration; } else { $pageId = $this->getCurrentBePageId(); if (isset(self::$cachedConfigurations[$pageId])) { $this->conf = self::$cachedConfigurations[$pageId]; } else { // We need to create our own template setup if we are in the // BE and we aren't currently creating a DirectMail page. if (TYPO3_MODE === 'BE' && $frontEnd === NULL) { $this->conf = $this->retrievePageConfig($pageId); } else { // On the front end, we can use the provided template setup. $this->conf = $frontEnd->tmpl->setup['plugin.']['tx_' . $this->extKey . '.']; } self::$cachedConfigurations[$pageId] = $this->conf; } } $this->ensureContentObject(); $this->pi_setPiVarDefaults(); $this->pi_loadLL(); if ($this->extKey !== '' && Tx_Oelib_ConfigurationProxy::getInstance($this->extKey)->getAsBoolean('enableConfigCheck')) { $configurationCheckClassName = 'tx_' . $this->extKey . '_configcheck'; if (class_exists($configurationCheckClassName, TRUE)) { $this->configurationCheck = t3lib_div::makeInstance($configurationCheckClassName, $this); } } $this->isInitialized = TRUE; }
/** * Purges the current instances so that getInstance will create new instances. * * @return void */ public static function purgeInstances() { self::$instances = array(); }