public function testDefault() { $entity = new MultiImage(); $entity->setName('test.jpg'); $entity->setHash('hash'); $entity->setTitle('title'); $entity->setCaption('caption'); $entity->setDescription('desc'); $entity->setEnabled(true); $entity->setScheduledForDeletion(true); $entity->setPosition(1); $this->assertNull($entity->getCurrentVersion()); $this->em->persist($entity); $this->em->flush($entity); $this->assertNotNull($entity->getId()); $this->assertSame('test.jpg', $entity->getName()); $this->assertSame('hash', $entity->getHash()); $this->assertSame('title', $entity->getTitle()); $this->assertSame('caption', $entity->getCaption()); $this->assertSame('desc', $entity->getDescription()); $this->assertSame(1, $entity->getVersion()); $this->assertTrue($entity->isEnabled()); $this->assertTrue($entity->isScheduledForDeletion()); $this->assertSame(1, $entity->getPosition()); $this->assertSame('/media/images', $entity->getUploadDir()); $this->assertSame('/media/images/test.jpg', $entity->getImagePath()); $entity->setCurrentVersion(2); }
protected function populate() { $multiImage = new MultiImage(); $multiImage->setName('name'); $multiImage->setHash('hash'); $multiImage->setPosition(1); $this->em->persist($multiImage); $this->em->flush(); $this->em->clear(); }
protected function populate() { $project = new Project(); $project->setTitle('project'); $this->em->persist($project); for ($i = 1; $i < 5; $i++) { $image = new MultiImage(); $image->setName('name' . $i); $image->setHash(md5($i)); $image->setPosition($i); $this->em->persist($image); $project->addImage($image); } $this->em->flush(); $this->em->clear(); }