public function testNotBlankValidation() { $notBlank = array('year', 'startDate', 'endDate'); $this->validateNotBlanks($notBlank); $this->object->setYear(2001); $this->object->setStartDate(new \DateTime()); $this->object->setEndDate(new \DateTime()); $this->validate(0); }
public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.curriculumInventoryReport')->getAll(); foreach ($data as $arr) { $entity = new CurriculumInventoryReport(); $entity->setId($arr['id']); $manager->persist($entity); $this->addReference('curriculumInventoryReports' . $arr['id'], $entity); } $manager->flush(); }
public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.curriculumInventoryReport')->getAll(); foreach ($data as $arr) { $entity = new CurriculumInventoryReport(); $entity->setId($arr['id']); $entity->setName($arr['name']); $entity->setDescription($arr['description']); $entity->setYear($arr['year']); $entity->setStartDate(new \DateTime($arr['startDate'])); $entity->setEndDate(new \DateTime($arr['endDate'])); $entity->setProgram($this->getReference('programs' . $arr['program'])); $entity->generateToken(); $manager->persist($entity); $this->addReference('curriculumInventoryReports' . $arr['id'], $entity); } $manager->flush(); }
public function testCommandPrintsOutNewReportIdOnSuccess() { $reportId = '1'; $newReportId = 5; $this->service->shouldReceive('rollover')->andReturnUsing(function () use($newReportId) { $report = new CurriculumInventoryReport(); $report->setId($newReportId); return $report; }); $this->reportManager->shouldReceive('findOneBy')->with(['id' => $reportId])->andReturnUsing(function () use($reportId) { $report = new CurriculumInventoryReport(); $report->setId($reportId); return $report; }); $this->commandTester->execute(['command' => self::COMMAND_NAME, 'reportId' => $reportId]); $this->service->shouldHaveReceived('rollover')->withAnyArgs()->once(); $output = $this->commandTester->getDisplay(); $this->assertEquals("The given report has been rolled over. The new report id is {$newReportId}.", trim($output)); }
/** * @covers \Ilios\CoreBundle\Entity\CurriculumInventoryReport::getSchool */ public function testGetSchool() { $school = new School(); $program = new Program(); $program->setSchool($school); $report = new CurriculumInventoryReport(); $report->setProgram($program); $this->assertEquals($school, $report->getSchool()); $program = new Program(); $report = new CurriculumInventoryReport(); $report->setProgram($program); $this->assertNull($report->getSchool()); $report = new CurriculumInventoryReport(); $this->assertNull($report->getSchool()); }