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(1); $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 testNotNullValidation() { $notNulls = array('report'); $this->object->setTitle('test title for the block max 200'); $this->object->setChildSequenceOrder(1); $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->validateNotNulls($notNulls); $this->object->setReport(m::mock('Ilios\\CoreBundle\\Entity\\CurriculumInventoryReportInterface')); $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(); }