public function testNotBlankValidation() { $notBlank = array('title', 'childSequenceOrder', 'orderInSequence', 'minimum', 'maximum', 'startDate', 'endDate', 'duration'); $this->validateNotBlanks($notBlank); $this->object->setTitle('test title for the block max 200'); $this->object->setChildSequenceOrder(true); // this fails when a False is passed I have noticed $this->object->setOrderInSequence(2); $this->object->setMinimum(1); $this->object->setMaximum(521); $this->object->setStartDate(new \DateTime()); $this->object->setEndDate(new \DateTime()); $this->object->setDuration(60); $this->validate(0); }
public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.curriculumInventorySequenceBlock')->getAll(); foreach ($data as $arr) { $entity = new CurriculumInventorySequenceBlock(); $entity->setId($arr['id']); $entity->setTitle($arr['title']); $entity->setTrack($arr['track']); $entity->setChildSequenceOrder($arr['childSequenceOrder']); $entity->setOrderInSequence($arr['orderInSequence']); $entity->setMinimum($arr['minimum']); $entity->setMaximum($arr['maximum']); $entity->setDuration($arr['duration']); $entity->setRequired($arr['required']); $entity->setStartDate(new \DateTime($arr['startDate'])); $entity->setEndDate(new \DateTime($arr['endDate'])); $entity->setAcademicLevel($this->getReference('curriculumInventoryAcademicLevels' . $arr['academicLevel'])); $entity->setReport($this->getReference('curriculumInventoryReports' . $arr['report'])); if (!empty($arr['parent'])) { $entity->setParent($this->getReference('curriculumInventorySequenceBlocks' . $arr['parent'])); } foreach ($arr['sessions'] as $sessionId) { $entity->addSession($this->getReference('sessions' . $sessionId)); } $manager->persist($entity); $this->addReference('curriculumInventorySequenceBlocks' . $arr['id'], $entity); } $manager->flush(); }
/** * @return array */ public function testCompareSequenceBlocksWithDefaultStrategyProvider() { $rhett = []; $level1 = new CurriculumInventoryAcademicLevel(); $level1->setLevel(1); $level10 = new CurriculumInventoryAcademicLevel(); $level10->setLevel(10); $blockA = new CurriculumInventorySequenceBlock(); $blockA->setId(1); $blockA->setTitle("Alpha"); $blockA->setStartDate(new \DateTime('2015-09-17')); $blockA->setAcademicLevel($level1); // same as A but with different level $blockB = new CurriculumInventorySequenceBlock(); $blockB->setId(1); $blockB->setTitle("Alpha"); $blockB->setStartDate(new \DateTime('2015-09-17')); $blockB->setAcademicLevel($level10); // same as A but with different start date $blockC = new CurriculumInventorySequenceBlock(); $blockC->setId(1); $blockC->setTitle("Alpha"); $blockC->setStartDate(new \DateTime('2019-09-17')); $blockC->setAcademicLevel($level1); // same as A but with different title $blockD = new CurriculumInventorySequenceBlock(); $blockD->setId(1); $blockD->setTitle("Beta"); $blockD->setStartDate(new \DateTime('2015-09-17')); $blockD->setAcademicLevel($level1); // same as A but with different id $blockE = new CurriculumInventorySequenceBlock(); $blockE->setId(2); $blockE->setTitle("Alpha"); $blockE->setStartDate(new \DateTime('2015-09-17')); $blockE->setAcademicLevel($level1); $rhett[] = [$blockA, $blockA, 0]; $rhett[] = [$blockB, $blockA, 1]; $rhett[] = [$blockA, $blockB, -1]; $rhett[] = [$blockC, $blockA, 1]; $rhett[] = [$blockA, $blockC, -1]; $rhett[] = [$blockD, $blockA, 1]; $rhett[] = [$blockA, $blockD, -1]; $rhett[] = [$blockE, $blockA, 1]; $rhett[] = [$blockA, $blockE, -1]; return $rhett; }