/** * Updates the place relations of the event in replacing them with the place * relations of the time slots. * This function will remove existing place relations and adds relations to * all places of the event's time slots in the database. * This function is a no-op for events without time slots. * * @return int the number of place relations of the event, will be >= 0 */ public function updatePlaceRelationsFromTimeSlots() { if (!$this->hasTimeslots()) { return 0; } $timeSlotBag = $this->createTimeSlotBag(); if ($timeSlotBag->isEmpty()) { return $this->getNumberOfPlaces(); } // Removes all place relations of the current event. tx_oelib_db::delete('tx_seminars_seminars_place_mm', 'tx_seminars_seminars_place_mm.uid_local = ' . $this->getUid()); // Creates an array with all place UIDs which should be related to this // event. $placesOfTimeSlots = array(); /** @var tx_seminars_timeslot $organizer */ foreach ($timeSlotBag as $timeSlot) { if ($timeSlot->hasPlace()) { $placesOfTimeSlots[] = $timeSlot->getPlace(); } } return $this->createMmRecords('tx_seminars_seminars_place_mm', $placesOfTimeSlots); }
/** * @test */ public function createRegistrationCallsSeminarRegistrationCreatedHook() { $this->createAndLoginFrontEndUser(); $hookClass = uniqid('tx_registrationHook'); $hook = $this->getMock($hookClass, array('seminarRegistrationCreated')); // We cannot test for the expected parameters because the registration // instance does not exist yet at this point. $hook->expects(self::once())->method('seminarRegistrationCreated'); $GLOBALS['T3_VAR']['getUserObj'][$hookClass] = $hook; $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seminars']['registration'][$hookClass] = $hookClass; $plugin = new tx_seminars_FrontEnd_DefaultController(); $plugin->cObj = $GLOBALS['TSFE']->cObj; $fixture = $this->getMock('tx_seminars_registrationmanager', array('notifyAttendee', 'notifyOrganizers', 'sendAdditionalNotification', 'setRegistrationData')); $fixture->createRegistration($this->seminar, array(), $plugin); $uid = $fixture->getRegistration()->getUid(); tx_oelib_db::delete('tx_seminars_attendances', 'uid = ' . $uid); }