public function testAllGood() { $entity = new Project(); $entity->setName('Some proj'); $entity->setCreatedAt(new \DateTime()); $entity->setEndAt(new \DateTime('+5 months')); $entity->setIsInternal(false); $entity->setAm(new AM()); $validator = $this->getContainer()->get('validator'); $errors = $validator->validate($entity); $this->assertEquals(0, count($errors)); }
public function load(ObjectManager $manager) { $internal = new Project(); $internal->setName('INTERNAL'); $internal->setCreatedAt(new \DateTime()); $internal->setIsInternal(true); $manager->persist($internal); for ($i = 0; $i < 5; $i++) { $project = new Project(); $project->setName('Project' . ($i + 1)); $project->setCreatedAt(new \DateTime()); $project->setEndAt(new \DateTime('+6 months')); $project->setIsInternal(false); $manager->persist($project); } $manager->flush(); }