protected function setUp() { tx_oelib_configurationProxy::getInstance('seminars')->setAsBoolean('enableConfigCheck', FALSE); $this->extConfBackup = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']; $this->t3VarBackup = $GLOBALS['T3_VAR']['getUserObj']; $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seminars'] = array(); $this->testingFramework = new tx_oelib_testingFramework('tx_seminars'); $this->testingFramework->createFakeFrontEnd(); tx_oelib_headerProxyFactory::getInstance()->enableTestMode(); $configuration = new tx_oelib_Configuration(); $configuration->setAsString('currency', 'EUR'); tx_oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_seminars', $configuration); $this->systemFolderPid = $this->testingFramework->createSystemFolder(); $this->seminarUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('pid' => $this->systemFolderPid, 'title' => 'Test & event', 'subtitle' => 'Something for you & me', 'accreditation_number' => '1 & 1', 'room' => 'Rooms 2 & 3')); $this->fixture = new tx_seminars_FrontEnd_DefaultController(); $this->fixture->init(array('isStaticTemplateLoaded' => 1, 'enableRegistration' => 1, 'templateFile' => 'EXT:seminars/Resources/Private/Templates/FrontEnd/FrontEnd.html', 'what_to_display' => 'seminar_list', 'pidList' => $this->systemFolderPid, 'pages' => $this->systemFolderPid, 'recursive' => 1, 'listView.' => array('orderBy' => 'data', 'descFlag' => 0, 'results_at_a_time' => 999, 'maxPages' => 5), 'eventFieldsOnRegistrationPage' => 'title,price_regular,price_special,vacancies,accreditation_number', 'linkToSingleView' => 'always')); $this->fixture->getTemplateCode(); $this->fixture->setLabels(); $this->fixture->createHelperObjects(); tx_oelib_templatehelper::setCachedConfigurationValue('dateFormatYMD', '%d.%m.%Y'); tx_oelib_templatehelper::setCachedConfigurationValue('timeFormat', '%H:%M'); $this->linkBuilder = $this->getMock('tx_seminars_Service_SingleViewLinkBuilder', array('createRelativeUrlForEvent')); $this->linkBuilder->expects(self::any())->method('createRelativeUrlForEvent')->will(self::returnValue('index.php?id=42&tx_seminars_pi1%5BshowUid%5D=1337')); $this->fixture->injectLinkBuilder($this->linkBuilder); /** @var $content tslib_cObj|PHPUnit_Framework_MockObject_MockObject */ $content = $this->getMock('tslib_cObj', array('IMAGE')); $content->expects(self::any())->method('IMAGE')->will(self::returnValue('<img src="foo.jpg" alt="bar"/>')); $this->fixture->cObj = $content; }
protected function setUp() { $this->testingFramework = new tx_oelib_testingFramework('tx_seminars'); $this->configuration = new tx_oelib_Configuration(); $this->configuration->setAsString('dateFormatYMD', self::DATE_FORMAT_YMD); $this->configuration->setAsString('dateFormatY', self::DATE_FORMAT_Y); $this->configuration->setAsString('dateFormatM', self::DATE_FORMAT_M); $this->configuration->setAsString('dateFormatMD', self::DATE_FORMAT_MD); $this->configuration->setAsString('dateFormatD', self::DATE_FORMAT_D); tx_oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_seminars', $this->configuration); $this->translator = tx_oelib_TranslatorRegistry::getInstance()->get('seminars'); $this->fixture = new tx_seminars_ViewHelper_DateRange(); }
protected function setUp() { $this->testingFramework = new tx_oelib_testingFramework('tx_seminars'); $frontEndPageUid = $this->testingFramework->createFrontEndPage(); $this->testingFramework->createFakeFrontEnd($frontEndPageUid); $this->session = new tx_oelib_FakeSession(); tx_oelib_Session::setInstance(tx_oelib_Session::TYPE_USER, $this->session); $configurationRegistry = tx_oelib_ConfigurationRegistry::getInstance(); $configuration = new tx_oelib_Configuration(); $configuration->setAsString('currency', 'EUR'); $configurationRegistry->set('plugin.tx_seminars', $configuration); $configurationRegistry->set('plugin.tx_staticinfotables_pi1', new tx_oelib_Configuration()); $this->seminar = new tx_seminars_seminar($this->testingFramework->createRecord('tx_seminars_seminars', array('payment_methods' => '1'))); $this->seminarUid = $this->seminar->getUid(); $this->fixture = new tx_seminars_FrontEnd_RegistrationForm(array('pageToShowAfterUnregistrationPID' => $frontEndPageUid, 'sendParametersToThankYouAfterRegistrationPageUrl' => 1, 'thankYouAfterRegistrationPID' => $frontEndPageUid, 'sendParametersToPageToShowAfterUnregistrationUrl' => 1, 'templateFile' => 'EXT:seminars/Resources/Private/Templates/FrontEnd/FrontEnd.html', 'logOutOneTimeAccountsAfterRegistration' => 1, 'showRegistrationFields' => 'registered_themselves,attendees_names', 'showFeUserFieldsInRegistrationForm' => 'name,email', 'showFeUserFieldsInRegistrationFormWithLabel' => 'email', 'form.' => array('unregistration.' => array(), 'registration.' => array('step1.' => array(), 'step2.' => array()))), $GLOBALS['TSFE']->cObj); $this->fixture->setAction('register'); $this->fixture->setSeminar($this->seminar); $this->fixture->setTestMode(); }
/** * @test */ public function renderWithUidOfExistingEventReturnsDateOfSelectedEvent() { $dateFormat = '%d.%m.%Y'; $configuration = new tx_oelib_Configuration(); $configuration->setAsString('dateFormatYMD', $dateFormat); tx_oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_seminars_seminars', $configuration); $this->fixture->piVars['uid'] = $this->eventId; self::assertContains(strftime($dateFormat, $this->eventDate), $this->fixture->render()); }