protected function populate()
 {
     $object = new MultiImage();
     $object->setName('name.jpg');
     $object->setHash('hash');
     $object->setPosition(1);
     $this->em->persist($object);
     $this->em->flush();
     $this->em->clear();
 }
 public function testDefault()
 {
     $entity = new MultiImage();
     $entity->setName('test.jpg');
     $entity->setOriginalName('original.jpg');
     $entity->setHash('hash');
     $entity->setTitle('title');
     $entity->setCaption('caption');
     $entity->setDescription('desc');
     $entity->setCopywrite('copywrite');
     $entity->setAuthor('author');
     $entity->setMetadata(array('key' => 'value'));
     $entity->setSize(123456);
     $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('original.jpg', $entity->getOriginalName());
     $this->assertSame('hash', $entity->getHash());
     $this->assertSame('title', $entity->getTitle());
     $this->assertSame('caption', $entity->getCaption());
     $this->assertSame('desc', $entity->getDescription());
     $this->assertSame('copywrite', $entity->getCopywrite());
     $this->assertSame('author', $entity->getAuthor());
     $this->assertSame(array('key' => 'value'), $entity->getMetadata());
     $this->assertSame(123456, $entity->getSize());
     $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()
 {
     $project = new Project();
     $project->setTitle('project');
     $this->em->persist($project);
     for ($i = 1; $i < 5; $i++) {
         $multiImage = new MultiImage();
         $multiImage->setName('name' . $i);
         $multiImage->setOriginalName('original_name' . $i);
         $multiImage->setHash(md5($i));
         $multiImage->setPosition($i);
         $this->em->persist($multiImage);
         $project->addImage($multiImage);
     }
     $this->em->flush();
     $this->em->clear();
 }