public function testNotNullValidation() { $notNull = array('school'); $this->object->setTitle('DVc'); $this->object->setDuration(30); $this->validateNotNulls($notNull); $this->object->setSchool(m::mock('Ilios\\CoreBundle\\Entity\\SchoolInterface')); $this->validate(0); }
public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.program')->getAll(); foreach ($data as $arr) { $entity = new Program(); $entity->setId($arr['id']); $entity->setTitle($arr['title']); $entity->setShortTitle($arr['shortTitle']); $entity->setDuration($arr['duration']); $entity->setPublishedAsTbd($arr['publishedAsTbd']); $entity->setPublished($arr['published']); $entity->setSchool($this->getReference('schools' . $arr['school'])); $manager->persist($entity); $this->addReference('programs' . $arr['id'], $entity); } $manager->flush(); }
/** * @covers \Ilios\CoreBundle\Entity\ProgramYearSteward::getProgramOwningSchool */ public function testGetProgramOwningSchool() { $school = new School(); $program = new Program(); $program->setSchool($school); $programYear = new ProgramYear(); $programYear->setProgram($program); $pySteward = new ProgramYearSteward(); $pySteward->setProgramYear($programYear); $this->assertEquals($school, $pySteward->getProgramOwningSchool()); $program = new Program(); $programYear = new ProgramYear(); $programYear->setProgram($program); $pySteward = new ProgramYearSteward(); $pySteward->setProgramYear($programYear); $this->assertNull($pySteward->getProgramOwningSchool()); $programYear = new ProgramYear(); $pySteward = new ProgramYearSteward(); $pySteward->setProgramYear($programYear); $this->assertNull($pySteward->getProgramOwningSchool()); $pySteward = new ProgramYearSteward(); $this->assertNull($pySteward->getProgramOwningSchool()); }
/** * @covers \Ilios\CoreBundle\Entity\Cohort::getSchool */ public function testGetSchool() { $school = new School(); $program = new Program(); $program->setSchool($school); $programYear = new ProgramYear(); $programYear->setProgram($program); $cohort = new Cohort(); $cohort->setProgramYear($programYear); $this->assertEquals($school, $cohort->getSchool()); $program = new Program(); $programYear = new ProgramYear(); $programYear->setProgram($program); $cohort = new Cohort(); $cohort->setProgramYear($programYear); $this->assertNull($cohort->getSchool()); $programYear = new ProgramYear(); $cohort = new Cohort(); $cohort->setProgramYear($programYear); $this->assertNull($cohort->getSchool()); $cohort = new Cohort(); $this->assertNull($cohort->getSchool()); }
/** * @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()); }