protected function populate()
 {
     $multiFile = new MultiFile();
     $multiFile->setName('name');
     $multiFile->setHash('hash');
     $multiFile->setPosition(1);
     $this->em->persist($multiFile);
     $this->em->flush();
     $this->em->clear();
 }
 public function testDefault()
 {
     $entity = new MultiFile();
     $entity->setName('file.txt');
     $entity->setOriginalName('original.txt');
     $entity->setSize(123456);
     $entity->setHash('hash');
     $entity->setTitle('title');
     $entity->setCaption('caption');
     $entity->setDescription('desc');
     $entity->setCopywrite('copywrite');
     $entity->setAuthor('author');
     $entity->setMetadata(array('key' => 'value'));
     $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('file.txt', $entity->getName());
     $this->assertSame('original.txt', $entity->getOriginalName());
     $this->assertSame(123456, $entity->getSize());
     $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(1, $entity->getVersion());
     $this->assertTrue($entity->isEnabled());
     $this->assertTrue($entity->isScheduledForDeletion());
     $this->assertSame(1, $entity->getPosition());
     $this->assertSame('/media/files/main', $entity->getUploadDir());
     $this->assertSame('/media/files/main/file.txt', $entity->getFilePath());
     $entity->setCurrentVersion(2);
 }
 protected function populate()
 {
     $project = new Project();
     $project->setTitle('project');
     $this->em->persist($project);
     for ($i = 1; $i < 5; $i++) {
         $multiFile = new MultiFile();
         $multiFile->setName('name' . $i);
         $multiFile->setOriginalName('original_name' . $i);
         $multiFile->setHash(md5($i));
         $multiFile->setPosition($i);
         $this->em->persist($multiFile);
         $project->addFile($multiFile);
     }
     $this->em->flush();
     $this->em->clear();
 }