delete(); self::$summit_repository = EntityManager::getRepository(Summit::class); self::$summit_permission_group_repository = EntityManager::getRepository(SummitAdministratorPermissionGroup::class); self::$summit = new Summit(); self::$summit->setActive(true); // set feed type (sched) self::$summit->setApiFeedUrl(""); self::$summit->setApiFeedKey(""); self::$summit->setTimeZoneId("America/Chicago"); $time_zone = new DateTimeZone("America/Chicago"); $begin_date = new \DateTime("now", $time_zone); self::$summit->setBeginDate($begin_date); self::$summit->setEndDate((clone $begin_date)->add(new DateInterval("P30D"))); self::$summit->setRegistrationBeginDate($begin_date); self::$summit->setRegistrationEndDate((clone $begin_date)->add(new DateInterval("P30D"))); self::$summit->setName("TEST SUMMIT"); $presentation_type = new PresentationType(); $presentation_type->setType('TEST PRESENTATION TYPE'); $presentation_type->setMinSpeakers(1); $presentation_type->setMaxSpeakers(3); $presentation_type->setMinModerators(0); $presentation_type->setMaxModerators(0); $presentation_type->setUseSpeakers(true); $presentation_type->setShouldBeAvailableOnCfp(true); $presentation_type->setAreSpeakersMandatory(false); $presentation_type->setUseModerator(false); $presentation_type->setIsModeratorMandatory(false); self::$summit->addEventType($presentation_type); self::$summit2 = new Summit(); self::$summit2->setActive(true); // set feed type (sched) self::$summit2->setApiFeedUrl(""); self::$summit2->setApiFeedKey(""); self::$summit2->setTimeZoneId("America/Chicago"); $time_zone = new DateTimeZone("America/Chicago"); $begin_date = new \DateTime("now", $time_zone); self::$summit2->setBeginDate($begin_date); self::$summit2->setEndDate((clone $begin_date)->add(new DateInterval("P30D"))); self::$summit2->setRegistrationBeginDate($begin_date); self::$summit2->setRegistrationEndDate((clone $begin_date)->add(new DateInterval("P30D"))); self::$summit2->setName("TEST SUMMIT2"); self::$mainVenue = new SummitVenue(); self::$mainVenue->setName("TEST VENUE"); self::$mainVenue->setIsMain(true); self::$summit->addLocation(self::$mainVenue); self::$defaultTrack = new PresentationCategory(); self::$defaultTrack->setTitle('DEFAULT TRACK'); self::$defaultTrack->setCode('DFT'); self::$defaultTrack->setSessionCount(3); self::$defaultTrack->setAlternateCount(3); self::$defaultTrack->setLightningCount(3); self::$defaultTrack->setChairVisible(true); self::$defaultTrack->setVotingVisible(true); self::$secondaryTrack = new PresentationCategory(); self::$secondaryTrack->setTitle('SECONDARY TRACK'); self::$secondaryTrack->setCode('SDFT'); self::$secondaryTrack->setSessionCount(3); self::$secondaryTrack->setAlternateCount(3); self::$secondaryTrack->setLightningCount(3); self::$secondaryTrack->setChairVisible(true); self::$secondaryTrack->setVotingVisible(true); $track_group = new PresentationCategoryGroup(); $track_group->setName("DEFAULT TRACK GROUP"); $track_group->addCategory(self::$defaultTrack); self::$summit->addPresentationCategory(self::$defaultTrack); self::$summit->addPresentationCategory(self::$secondaryTrack); self::$summit->addCategoryGroup($track_group); self::$defaultEventType = new PresentationType(); self::$defaultEventType->setType(IPresentationType::Presentation); self::$defaultEventType->setMinSpeakers(1); self::$defaultEventType->setMaxSpeakers(3); self::$defaultEventType->setMinModerators(0); self::$defaultEventType->setMaxModerators(0); self::$defaultEventType->setUseSpeakers(true); self::$defaultEventType->setShouldBeAvailableOnCfp(true); self::$defaultEventType->setAreSpeakersMandatory(false); self::$defaultEventType->setUseModerator(false); self::$defaultEventType->setIsModeratorMandatory(false); self::$summit->addEventType(self::$defaultEventType); self::$default_selection_plan = new SelectionPlan(); self::$default_selection_plan->setName("TEST_SELECTION_PLAN"); $submission_begin_date = new DateTime('now', self::$summit->getTimeZone()); $submission_end_date = (clone $submission_begin_date)->add(new DateInterval("P14D")); self::$default_selection_plan->setSummit(self::$summit); self::$default_selection_plan->setSubmissionBeginDate($submission_begin_date); self::$default_selection_plan->setSubmissionEndDate($submission_end_date); self::$default_selection_plan->setSelectionBeginDate($submission_begin_date); self::$default_selection_plan->setSelectionEndDate($submission_end_date); self::$default_selection_plan->setIsEnabled(true); self::$default_selection_plan->addTrackGroup($track_group); self::$summit->addSelectionPlan(self::$default_selection_plan); self::$em = Registry::getManager(SilverstripeBaseModel::EntityManager); if (!self::$em ->isOpen()) { self::$em = Registry::resetManager(SilverstripeBaseModel::EntityManager); } self::$presentations = []; for($i = 0 ; $i < 20; $i++){ $presentation = new Presentation(); $presentation->setTitle(sprintf("Presentation Title %s %s", $i, str_random(16))); $presentation->setAbstract(sprintf("Presentation Abstract %s %s", $i, str_random(16))); $presentation->setCategory(self::$defaultTrack); $presentation->setProgress(Presentation::PHASE_COMPLETE); $presentation->setStatus(Presentation::STATUS_RECEIVED); $presentation->setType( self::$defaultEventType ); self::$default_selection_plan->addPresentation($presentation); self::$summit->addEvent($presentation); self::$presentations[] = $presentation; } self::$summit_permission_group = new SummitAdministratorPermissionGroup(); self::$summit_permission_group->setTitle(sprintf("DEFAULT PERMISSION GROUP %s", str_random(16))); self::$summit_permission_group->addSummit(self::$summit); self::$em->persist(self::$summit); self::$em->persist(self::$summit2); self::$em->persist(self::$summit_permission_group); self::$em->flush(); } protected static function clearTestData(){ self::$em = Registry::resetManager(SilverstripeBaseModel::EntityManager); self::$summit = self::$summit_repository->find(self::$summit->getId()); self::$summit2 = self::$summit_repository->find(self::$summit2->getId()); self::$summit_permission_group = self::$summit_permission_group_repository->find(self::$summit_permission_group->getId()); self::$em->remove(self::$summit); self::$em->remove(self::$summit2); self::$em->remove(self::$summit_permission_group); self::$em->flush(); } }