示例#1
0
 /**
  * Inserts a skill record into the database and creates a relation to it
  * from the fixture.
  *
  * @param array $skillData data of the skill to add, may be empty
  *
  * @return int the UID of the created record, will always be > 0
  */
 private function addSkillRelation(array $skillData)
 {
     $uid = $this->testingFramework->createRecord('tx_seminars_skills', $skillData);
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_speakers', $this->fixture->getUid(), $uid, 'skills');
     $this->fixture = new tx_seminars_speaker($this->fixture->getUid());
     return $uid;
 }
 protected function setUp()
 {
     $configuration = new Tx_Oelib_Configuration();
     Tx_Oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_seminars', $configuration);
     $this->extConfBackup = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'];
     $this->t3VarBackup = $GLOBALS['T3_VAR']['getUserObj'];
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seminars'] = array();
     $this->languageBackup = $GLOBALS['LANG']->lang;
     $GLOBALS['LANG']->lang = 'default';
     // Loads the locallang file for properly working localization in the tests.
     $GLOBALS['LANG']->includeLLFile('EXT:seminars/BackEnd/locallang.xml');
     tx_oelib_headerProxyFactory::getInstance()->enableTestMode();
     /** @var Tx_Oelib_MailerFactory $mailerFactory */
     $mailerFactory = t3lib_div::makeInstance('Tx_Oelib_MailerFactory');
     $mailerFactory->enableTestMode();
     $this->mailer = $mailerFactory->getMailer();
     $this->testingFramework = new tx_oelib_testingFramework('tx_seminars');
     tx_oelib_MapperRegistry::getInstance()->activateTestingMode($this->testingFramework);
     $this->dummySysFolderUid = $this->testingFramework->createSystemFolder();
     tx_oelib_PageFinder::getInstance()->setPageUid($this->dummySysFolderUid);
     $this->organizerUid = $this->testingFramework->createRecord('tx_seminars_organizers', array('title' => 'Dummy Organizer', 'email' => '*****@*****.**'));
     $this->eventUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('pid' => $this->dummySysFolderUid, 'title' => 'Dummy event', 'object_type' => tx_seminars_Model_Event::TYPE_DATE, 'begin_date' => $GLOBALS['SIM_EXEC_TIME'] + 86400, 'organizers' => 0));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $this->eventUid, $this->organizerUid, 'organizers');
     $this->fixture = new tx_seminars_BackEnd_ConfirmEventMailForm($this->eventUid);
 }
示例#3
0
 /**
  * @test
  */
 public function getSkillsWithOneSkillReturnsOneSkill()
 {
     $speakerUid = $this->testingFramework->createRecord('tx_seminars_speakers');
     $skill = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Skill')->getNewGhost();
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_speakers', $speakerUid, $skill->getUid(), 'skills');
     /** @var tx_seminars_Model_Speaker $model */
     $model = $this->fixture->find($speakerUid);
     self::assertEquals($skill->getUid(), $model->getSkills()->getUids());
 }
示例#4
0
 /**
  * @test
  */
 public function getDependenciesForEventTopicWithOneDependencyReturnsOneDependency()
 {
     $uid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC));
     $relatedUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $relatedUid, $uid, 'dependencies');
     /** @var tx_seminars_Model_Event $model */
     $model = $this->fixture->find($relatedUid);
     self::assertEquals($uid, $model->getDependencies()->getUids());
 }
示例#5
0
 /**
  * @test
  */
 public function getSpeakersWithOneSpeakerReturnsOneSpeaker()
 {
     $timeSlotUid = $this->testingFramework->createRecord('tx_seminars_timeslots');
     $speaker = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Speaker')->getNewGhost();
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_timeslots', $timeSlotUid, $speaker->getUid(), 'speakers');
     /** @var tx_seminars_Model_TimeSlot $model */
     $model = $this->fixture->find($timeSlotUid);
     self::assertEquals($speaker->getUid(), $model->getSpeakers()->getUids());
 }
示例#6
0
 /**
  * @test
  */
 public function getCheckboxesForSingleEventWithOneCheckboxReturnsOneCheckbox()
 {
     $uid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_COMPLETE));
     $checkbox = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Checkbox')->getNewGhost();
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $uid, $checkbox->getUid(), 'checkboxes');
     /** @var tx_seminars_Model_Event $model */
     $model = $this->fixture->find($uid);
     self::assertEquals($checkbox->getUid(), $model->getCheckboxes()->getUids());
 }
示例#7
0
 /**
  * @test
  */
 public function getCheckboxesWithOneCheckboxReturnsOneCheckbox()
 {
     $uid = $this->testingFramework->createRecord('tx_seminars_attendances');
     $checkbox = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Checkbox')->getNewGhost();
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_attendances', $uid, $checkbox->getUid(), 'checkboxes');
     /** @var tx_seminars_Model_Registration $model */
     $model = $this->fixture->find($uid);
     self::assertEquals($checkbox->getUid(), $model->getCheckboxes()->first()->getUid());
 }
示例#8
0
 /**
  * @test
  */
 public function getEventManagersWithOneEventManagerReturnsOneEventManager()
 {
     $uid = $this->testingFramework->createRecord('tx_seminars_seminars');
     $frontEndUser = tx_oelib_MapperRegistry::get('tx_oelib_Mapper_FrontEndUser')->getNewGhost();
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $uid, $frontEndUser->getUid(), 'vips');
     /** @var tx_seminars_Model_Event $model */
     $model = $this->fixture->find($uid);
     self::assertEquals($frontEndUser->getUid(), $model->getEventManagers()->getUids());
 }
示例#9
0
 /**
  * @test
  */
 public function setRegistrationDataForNoPaymentMethodSetAndPositiveTotalPriceWithSeminarWithOnePaymentMethodSelectsThatPaymentMethod()
 {
     tx_oelib_ConfigurationRegistry::get('plugin.tx_seminars')->setAsString('currency', 'EUR');
     $this->testingFramework->changeRecord('tx_seminars_seminars', $this->seminarUid, array('price_regular' => 31.42));
     $paymentMethodUid = $this->testingFramework->createRecord('tx_seminars_payment_methods');
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $this->seminarUid, $paymentMethodUid, 'payment_methods');
     $seminar = new tx_seminars_seminar($this->seminarUid);
     $this->fixture->setRegistrationData($seminar, 0, array());
     self::assertSame($paymentMethodUid, $this->fixture->getMethodOfPaymentUid());
 }
 /**
  * @test
  */
 public function notifyAttendeeForPlaceAddressWithCityAndNoCountryNotAddsSurplusCommaAfterCity()
 {
     $this->fixture->setConfigurationValue('sendConfirmation', TRUE);
     $uid = $this->testingFramework->createRecord('tx_seminars_sites', array('address' => 'address', 'city' => 'footown'));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $this->seminarUid, $uid, 'place');
     $pi1 = new tx_seminars_FrontEnd_DefaultController();
     $pi1->init();
     $registration = $this->createRegistration();
     $this->fixture->notifyAttendee($registration, $pi1);
     self::assertNotContains('footown,', $this->mailer->getFirstSentEmail()->getBody());
 }
示例#11
0
 /**
  * @test
  */
 public function getRequirementsForTwoRequirementsReturnsBagWithTwoItems()
 {
     $topicUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC));
     $requiredTopicUid1 = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $topicUid, $requiredTopicUid1, 'requirements');
     $requiredTopicUid2 = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $topicUid, $requiredTopicUid2, 'requirements');
     $topic = new tx_seminars_seminarchild($topicUid);
     $requirements = $topic->getRequirements();
     self::assertSame(2, $requirements->count());
 }
 /**
  * @test
  */
 public function renderForEmptyLinkShowsErrorMessage()
 {
     $topicUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('title' => 'Dummy event', 'object_type' => tx_seminars_Model_Event::TYPE_TOPIC));
     $dateUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_DATE, 'topic' => $topicUid));
     $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_DATE, 'topic' => $topicUid, 'begin_date' => $GLOBALS['SIM_EXEC_TIME'] + tx_oelib_Time::SECONDS_PER_DAY));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $dateUid, $this->testingFramework->createRecord('tx_seminars_organizers'), 'organizers');
     $fixture = new tx_seminars_BackEnd_CancelEventMailForm($dateUid);
     $linkBuilder = $this->getMock('tx_seminars_Service_SingleViewLinkBuilder', array('createAbsoluteUrlForEvent'));
     $linkBuilder->expects(self::any())->method('createAbsoluteUrlForEvent')->will(self::returnValue(''));
     $fixture->injectLinkBuilder($linkBuilder);
     self::assertContains($GLOBALS['LANG']->getLL('eventMailForm_error_noDetailsPageFound'), $fixture->render());
 }
示例#13
0
 public function testListOfRequirementsForEventWithTwoNotFulfilledRequirementsShownsTitlesOfBothRequirements()
 {
     $this->testingFramework->createAndLoginFrontEndUser();
     $this->fixture->setConfigurationValue('what_to_display', 'seminar_registration');
     $topic = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC));
     $date = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_DATE, 'begin_date' => $GLOBALS['SIM_EXEC_TIME'] + 1000, 'end_date' => $GLOBALS['SIM_EXEC_TIME'] + 2000, 'attendees_max' => 10, 'topic' => $topic, 'needs_registration' => 1));
     $requiredTopic1 = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC, 'title' => 'required_foo'));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $topic, $requiredTopic1, 'requirements');
     $requiredTopic2 = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC, 'title' => 'required_bar'));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $topic, $requiredTopic2, 'requirements');
     $this->fixture->piVars['seminar'] = $date;
     self::assertRegExp('/required_foo.*required_bar/s', $this->fixture->main('', array()));
 }
示例#14
0
 /**
  * @test
  */
 public function limitToMissingRegistrationsLimitsOutputToMissingRegistrationsOnly()
 {
     $userUid = $this->testingFramework->createAndLoginFrontEndUser();
     $this->testingFramework->changeRecord('tx_seminars_seminars', $this->seminarUid, array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC));
     $requiredEvent1 = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC, 'title' => 'required_foo'));
     $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_DATE, 'topic' => $requiredEvent1));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $this->seminarUid, $requiredEvent1, 'requirements');
     $requiredEvent2 = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC, 'title' => 'required_bar'));
     $requiredDate2 = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_DATE, 'topic' => $requiredEvent2));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $this->seminarUid, $requiredEvent2, 'requirements');
     $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $requiredDate2, 'user' => $userUid));
     $this->fixture->setEvent(new tx_seminars_seminar($this->seminarUid));
     $this->fixture->limitToMissingRegistrations();
     self::assertNotContains('required_bar', $this->fixture->render());
 }
示例#15
0
 /**
  * @test
  */
 public function renderForEnabledCategoryCanPreselectTwoValues()
 {
     $this->fixture->setConfigurationValue('displaySearchFormFields', 'categories');
     $eventUid = $this->testingFramework->createRecord('tx_seminars_seminars');
     $categoryName1 = 'Category 1';
     $categoryUid1 = $this->testingFramework->createRecord('tx_seminars_categories', array('title' => $categoryName1));
     $categoryName2 = 'Category 2';
     $categoryUid2 = $this->testingFramework->createRecord('tx_seminars_categories', array('title' => $categoryName2));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $eventUid, $categoryUid1, 'categories');
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $eventUid, $categoryUid2, 'categories');
     $this->fixture->piVars['categories'][] = (string) $categoryUid1;
     $this->fixture->piVars['categories'][] = (string) $categoryUid2;
     $output = $this->fixture->render();
     self::assertContains($categoryUid1 . '" selected="selected">' . $categoryName1 . '</option>', $output);
     self::assertContains($categoryUid2 . '" selected="selected">' . $categoryName2 . '</option>', $output);
 }