protected function setUp() { $this->testingFramework = new Tx_Oelib_TestingFramework('tx_seminars'); $this->configuration = new Tx_Oelib_Configuration(); $this->configuration->setAsString('timeFormat', self::TIME_FORMAT); Tx_Oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_seminars', $this->configuration); $this->translator = Tx_Oelib_TranslatorRegistry::getInstance()->get('seminars'); $this->translatedHours = ' ' . $this->translator->translate('label_hours'); $this->subject = new tx_seminars_ViewHelper_TimeRange(); }
protected function setUp() { $this->testingFramework = new Tx_Oelib_TestingFramework('tx_seminars'); $this->subject = new tx_seminars_EmailSalutation(); $configuration = new Tx_Oelib_Configuration(); $configuration->setAsString('salutation', 'formal'); Tx_Oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_seminars', $configuration); $this->extConfBackup = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']; $this->t3VarBackup = $GLOBALS['T3_VAR']['getUserObj']; }
/** * @test */ public function renderForQueueRegistrationsAllowedForEmailNotContainsRegistrationOnQueue() { $this->configuration->setAsBoolean('showAttendancesOnRegistrationQueueInEmailCsv', TRUE); $this->configuration->setAsBoolean('showAttendancesOnRegistrationQueueInCSV', FALSE); $this->configuration->setAsString('fieldsFromAttendanceForCsv', 'uid'); $this->configuration->setAsString('fieldsFromAttendanceForEmailCsv', 'uid'); $registrationUid = $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $this->eventUid, 'crdate' => $GLOBALS['SIM_EXEC_TIME'], 'user' => $this->testingFramework->createFrontEndUser(), 'registration_queue' => TRUE)); self::assertContains((string) $registrationUid, $this->subject->render()); }
/** * @test */ public function createAndOutputListOfRegistrationsForWebModeNotUsesRegistrationsOnQueueSettingFromEmailConfiguration() { $this->configuration->setAsBoolean('showAttendancesOnRegistrationQueueInEmailCsv', TRUE); $this->configuration->setAsString('fieldsFromAttendanceForEmailCsv', 'uid'); $this->configuration->setAsBoolean('showAttendancesOnRegistrationQueueInCsv', FALSE); $this->configuration->setAsString('fieldsFromAttendanceForCsv', 'uid'); $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $this->eventUid, 'user' => $this->testingFramework->createFrontEndUser())); $queueUid = $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $this->eventUid, 'user' => $this->testingFramework->createFrontEndUser(), 'bank_name' => 'foo bank', 'registration_queue' => 1)); self::assertNotContains((string) $queueUid, $this->fixture->createAndOutputListOfRegistrations($this->eventUid)); }
protected function setUp() { $pluginConfiguration = new Tx_Oelib_Configuration(); $pluginConfiguration->setAsString('dateFormatYMD', '%d.%m.%Y'); $configurationRegistry = Tx_Oelib_ConfigurationRegistry::getInstance(); $configurationRegistry->set('plugin.tx_seminars', $pluginConfiguration); $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(); // just picked some random date (2001-01-01 00:00:00) $this->eventDate = 978303600; $this->mapper = new tx_seminars_Mapper_Event(); $event = $this->mapper->getLoadedTestingModel(array('pid' => 0, 'title' => 'Test event', 'begin_date' => $this->eventDate)); $this->eventId = $event->getUid(); $this->fixture = new tx_seminars_FrontEnd_EventHeadline(array('isStaticTemplateLoaded' => 1, 'templateFile' => 'EXT:seminars/Resources/Private/Templates/FrontEnd/FrontEnd.html'), $GLOBALS['TSFE']->cObj); $this->fixture->injectEventMapper($this->mapper); }
protected function setUp() { $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath('seminars') . 'locallang_db.xml'); $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath('lang') . 'locallang_general.xml'); $this->testingFramework = new Tx_Oelib_TestingFramework('tx_seminars'); $configurationRegistry = Tx_Oelib_ConfigurationRegistry::getInstance(); $configurationRegistry->set('plugin', new Tx_Oelib_Configuration()); $this->configuration = new Tx_Oelib_Configuration(); $this->configuration->setData(array('charsetForCsv' => 'utf-8')); $configurationRegistry->set('plugin.tx_seminars', $this->configuration); $this->pageUid = $this->testingFramework->createSystemFolder(); $this->eventUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('pid' => $this->pageUid, 'begin_date' => $GLOBALS['SIM_EXEC_TIME'])); $this->subject = $this->getMockForAbstractClass('Tx_Seminars_Csv_AbstractRegistrationListView'); $this->subject->expects(self::any())->method('shouldAlsoContainRegistrationsOnQueue')->will(self::returnValue(TRUE)); $testCase = $this; $this->subject->expects(self::any())->method('getFrontEndUserFieldKeys')->will(self::returnCallback(function () use($testCase) { return $testCase->frontEndUserFieldKeys; })); $this->subject->expects(self::any())->method('getRegistrationFieldKeys')->will(self::returnCallback(function () use($testCase) { return $testCase->registrationFieldKeys; })); $this->subject->setEventUid($this->eventUid); }
/** * @test */ public function hasAccessForVipFrontEndUserAndVipAccessReturnsTrue() { $this->seminarsPluginConfiguration->setAsBoolean('allowCsvExportOfRegistrationsInMyVipEventsView', TRUE); $user = $this->getMock('tx_seminars_Model_FrontEndUser'); $userUid = 42; $user->expects(self::any())->method('getUid')->will(self::returnValue($userUid)); /** @var $user tx_seminars_Model_FrontEndUser */ Tx_Oelib_FrontEndLoginManager::getInstance()->logInUser($user); $event = $this->getMock('tx_seminars_seminar', array(), array(), '', FALSE); $event->expects(self::any())->method('isUserVip')->with($userUid, $this->vipsGroupUid)->will(self::returnValue(TRUE)); /** @var $event tx_seminars_seminar */ $this->subject->setEvent($event); self::assertTrue($this->subject->hasAccess()); }
/** * @test */ public function renderSeparatesHeadlineFieldsWithSemicolons() { $this->configuration->setAsString('fieldsFromEventsForCsv', 'description,title'); $this->createEventInFolderAndSetPageUid(); self::assertContains($this->localizeAndRemoveColon('tx_seminars_seminars.description') . ';' . $this->localizeAndRemoveColon('tx_seminars_seminars.title'), $this->subject->render($this->pageUid)); }
/** * Returns the time portion of the given UNIX timestamp in the format specified in plugin.tx_seminars.timeFormat. * * @param int $timestamp the UNIX timestamp to convert, must be >= 0 * * @return string the time portion of the UNIX timestamp formatted according to the format in plugin.tx_seminars.timeFormat */ protected function getAsTime($timestamp) { return strftime($this->configuration->getAsString('timeFormat'), $timestamp); }
/** * Reads the language key from a configuration and sets it as current language. * Also sets the alternate language if one is configured. * * The language key is read from the "language" key and the alternate language is read * from the language_alt key. * * @param Tx_Oelib_Configuration $configuration the configuration to read * * @return void */ private function setLanguageKeyFromConfiguration(Tx_Oelib_Configuration $configuration) { if (!$configuration->hasString('language')) { return; } $this->languageKey = $configuration->getAsString('language'); if ($configuration->hasString('language_alt')) { $this->alternativeLanguageKey = $configuration->getAsString('language_alt'); } }
/** * Sets the page's content type to CSV and the page's content disposition to the given filename. * * Adds the data directly to the page header. * * @param string $csvFileName the name for the page which is used as storage name, must not be empty * * @return void */ private function setPageTypeAndDisposition($csvFileName) { tx_oelib_headerProxyFactory::getInstance()->getHeaderProxy()->addHeader('Content-type: text/csv; header=present; charset=' . $this->configuration->getAsString('charsetForCsv')); tx_oelib_headerProxyFactory::getInstance()->getHeaderProxy()->addHeader('Content-disposition: attachment; filename=' . $csvFileName); }
/** * @test */ public function sendRemindersToOrganizersSendsReminderWithMessageWithEventsBeginDate() { $this->addSpeaker($this->createSeminarWithOrganizer(array('begin_date' => $GLOBALS['SIM_EXEC_TIME'] + tx_oelib_Time::SECONDS_PER_DAY, 'cancelled' => tx_seminars_seminar::STATUS_PLANNED))); $this->fixture->sendCancellationDeadlineReminders(); self::assertContains(strftime($this->configuration->getAsString('dateFormatYMD'), $GLOBALS['SIM_EXEC_TIME'] + tx_oelib_Time::SECONDS_PER_DAY), $this->mailer->getFirstSentEmail()->getBody()); }
/** * @test */ public function renderForBothConfigurationFieldsEmptyAndSeparatorDisabledReturnsEmptyLine() { $this->configuration->setAsBoolean('addExcelSpecificSeparatorLineToCsv', FALSE); self::assertSame(CRLF, $this->subject->render()); }
/** * Returns the keys of the fields to export. * * @return string[] */ protected function getFieldKeys() { return $this->configuration->getAsTrimmedArray('fieldsFromEventsForCsv'); }