Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 protected function setUp()
 {
     $this->testingFramework = new Tx_Oelib_TestingFramework('tx_seminars');
     /** @var Tx_Oelib_MailerFactory $mailerFactory */
     $mailerFactory = t3lib_div::makeInstance('Tx_Oelib_MailerFactory');
     $mailerFactory->enableTestMode();
     $this->mailer = $mailerFactory->getMailer();
     define('TYPO3_cliKey', 'seminars');
     $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys'][TYPO3_cliKey][1] = '_cli_seminars_test';
     $this->testingFramework->createBackEndUser(array('username' => '_cli_seminars_test'));
     tx_oelib_ConfigurationRegistry::getInstance()->set('plugin', new Tx_Oelib_Configuration());
     $this->configuration = new Tx_Oelib_Configuration();
     $this->configuration->setData(array('sendEventTakesPlaceReminderDaysBeforeBeginDate' => 2, 'sendCancelationDeadlineReminder' => TRUE, 'filenameForRegistrationsCsv' => 'registrations.csv', 'dateFormatYMD' => '%d.%m.%Y', 'fieldsFromAttendanceForEmailCsv' => 'title', 'showAttendancesOnRegistrationQueueInEmailCsv' => TRUE));
     tx_oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_seminars', $this->configuration);
     $this->fixture = new tx_seminars_cli_MailNotifier();
 }
Ejemplo n.º 4
0
 /**
  * Returns the price, formatted as configured in TS.
  *
  * @param string $value the price
  *
  * @return string the price, formatted as in configured in TS
  */
 public function formatPrice($value)
 {
     /** @var tx_oelib_ViewHelper_Price $priceViewHelper */
     $priceViewHelper = t3lib_div::makeInstance('tx_oelib_ViewHelper_Price');
     $priceViewHelper->setCurrencyFromIsoAlpha3Code(tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars')->getAsString('currency'));
     $priceViewHelper->setValue((double) $value);
     return $priceViewHelper->render();
 }
Ejemplo n.º 5
0
 /**
  * @test
  */
 public function populateListOrganizersForSetStoragePageAndAuxiliaryRecordsConfigurationPidReturnsRecordWithAuxiliaryPid()
 {
     $pageUid = $this->testingFramework->createFrontEndPage(0, array('storage_pid' => 42));
     $this->testingFramework->createFakeFrontEnd($pageUid);
     $this->createLoginAndAddFrontEndUserToEventEditorFrontEndGroup();
     tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars_pi1')->set('createAuxiliaryRecordsPID', 21);
     $organizerUid = $this->testingFramework->createRecord('tx_seminars_organizers', array('pid' => 21));
     self::assertTrue(in_array(array('caption' => '', 'value' => $organizerUid), $this->fixture->populateListOrganizers(array())));
 }
Ejemplo n.º 6
0
 /**
  * @test
  */
 public function getSalutationForInformalSalutationReturnsUsersName()
 {
     $user = $this->createFrontEndUser();
     tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars')->setAsString('salutation', 'informal');
     self::assertContains($user->getLastOrFullName(), $this->fixture->getSalutation($user));
 }
Ejemplo n.º 7
0
 /**
  * @test
  */
 public function getFeUserDataWithKeyCountryAndNoCountrySetReturnsDefaultCountrySetViaTypoScriptSetup()
 {
     $this->testingFramework->createAndLoginFrontEndUser();
     tx_oelib_ConfigurationRegistry::get('plugin.tx_staticinfotables_pi1')->setAsString('countryCode', 'DEU');
     self::assertEquals('Deutschland', $this->fixture->getFeUserData(NULL, array('key' => 'country')));
 }
Ejemplo n.º 8
0
 /**
  * Checks whether this extension's static template is included on the
  * current page.
  *
  * @return bool TRUE if the static template has been included, FALSE otherwise
  */
 private function hasStaticTemplate()
 {
     return tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars')->getAsBoolean('isStaticTemplateLoaded');
 }
Ejemplo n.º 9
0
 /**
  * Gets the Configuration for plugin.tx_seminars_pi1.
  *
  * @return Tx_Oelib_Configuration
  */
 protected static function getSeminarsConfiguration()
 {
     return tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars_pi1');
 }
Ejemplo n.º 10
0
 /**
  * @test
  */
 public function getSingleViewPageFromConfigurationForNoPluginSetReturnsPageUidFromTypoScriptSetup()
 {
     tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars_pi1')->set('detailPID', 91);
     $fixture = new tx_seminars_tests_fixtures_Service_TestingSingleViewLinkBuilder();
     self::assertEquals(91, $fixture->getSingleViewPageFromConfiguration());
 }
Ejemplo n.º 11
0
 /**
  * Retrieves the single view page UID from the flexforms/TS Setup
  * configuration.
  *
  * @return int
  *         the single view page UID from the configuration, will be 0 if no
  *         page UID has been set
  */
 protected function getSingleViewPageFromConfiguration()
 {
     if ($this->plugin !== NULL) {
         $result = $this->getPlugin()->getConfValueInteger('detailPID');
     } else {
         $result = tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars_pi1')->getAsInteger('detailPID');
     }
     return $result;
 }
Ejemplo n.º 12
0
 /**
  * The constructor.
  */
 public function __construct()
 {
     $this->configuration = tx_oelib_ConfigurationRegistry::getInstance()->get('plugin.tx_seminars');
     $this->translator = tx_oelib_TranslatorRegistry::getInstance()->get('seminars');
 }
Ejemplo n.º 13
0
 /**
  * @test
  */
 public function setTotalPriceWithTotalPriceSetsTotalPrice()
 {
     tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars')->setAsString('currency', 'EUR');
     $this->fixture->setTotalPrice('42.42');
     self::assertSame('€ 42,42', $this->fixture->getTotalPrice());
 }
 /**
  * Checks whether the CSV file should be added to the e-mail.
  *
  * @param tx_seminars_seminar $event the event to send the e-mail for
  *
  * @return bool TRUE if the CSV file should be added, FALSE otherwise
  */
 private function shouldCsvFileBeAdded(tx_seminars_seminar $event)
 {
     return tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars')->getAsBoolean('addRegistrationCsvToOrganizerReminderMail') && $event->getAttendances() > 0;
 }
Ejemplo n.º 15
0
 /**
  * Returns the default country as localized string.
  *
  * @return string the default country's localized name, will be empty if there is no default country
  */
 private function getDefaultCountry()
 {
     $defaultCountryCode = tx_oelib_ConfigurationRegistry::get('plugin.tx_staticinfotables_pi1')->getAsString('countryCode');
     if ($defaultCountryCode === '') {
         return '';
     }
     $this->initStaticInfo();
     if (class_exists('SJBR\\StaticInfoTables\\Utility\\LocalizationUtility', TRUE)) {
         $currentLanguageCode = Tx_Oelib_ConfigurationRegistry::get('config')->getAsString('language');
         $identifiers = array('iso' => $defaultCountryCode);
         $result = \SJBR\StaticInfoTables\Utility\LocalizationUtility::getLabelFieldValue($identifiers, 'static_countries', $currentLanguageCode, TRUE);
     } else {
         $result = tx_staticinfotables_div::getTitleFromIsoCode('static_countries', $defaultCountryCode, $this->staticInfo->getCurrentLanguage(), TRUE);
     }
     return $result;
 }
Ejemplo n.º 16
0
 /**
  * @test
  */
 public function createIntroductionForNoSalutationModeContainsNoRawLabelKeys()
 {
     $salutation = '';
     tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars')->setAsString('salutation', $salutation);
     $dateFormatYMD = '%d.%m.%Y';
     $eventUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('begin_date' => $GLOBALS['SIM_EXEC_TIME']));
     $event = new tx_seminars_seminarchild($eventUid, array('dateFormatYMD' => $dateFormatYMD, 'salutation' => $salutation));
     $introduction = $this->subject->createIntroduction('%s', $event);
     $this->assertNotContainsRawLabelKey($introduction);
 }
Ejemplo n.º 17
0
 /**
  * @test
  */
 public function notifyAttendeeForFormalSalutationAndGenderFemaleNotContainsRawTemplateMarkers()
 {
     if (!Tx_Oelib_Model_FrontEndUser::hasGenderField()) {
         self::markTestSkipped('This test is only applicable if there is a FrontEndUser.gender field.');
     }
     $this->fixture->setConfigurationValue('sendConfirmation', TRUE);
     tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars')->setAsString('salutation', 'formal');
     $registration = $this->createRegistration();
     $this->testingFramework->changeRecord('fe_users', $registration->getFrontEndUser()->getUid(), array('email' => '*****@*****.**', 'gender' => 1));
     $pi1 = new tx_seminars_FrontEnd_DefaultController();
     $pi1->init();
     $this->fixture->notifyAttendee($registration, $pi1);
     $this->assertNotContainsRawLabelKey($this->mailer->getFirstSentEmail()->getBody());
 }
Ejemplo n.º 18
0
 /**
  * @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());
 }