Exemplo n.º 1
0
 public function testInit()
 {
     $film = new Film(array('fr' => array('synopsis' => 'Voici le synopsis du film'), 'en' => array('synopsis' => 'Here is the film synopsis')));
     $datetime = new \DateTime();
     $director = new Director();
     $producer = new Producer();
     $film->setTitle('Un long fleuve tranquille');
     $film->setLengthMin(18);
     $film->setLengthSec(59);
     $film->setCompletionDate($datetime);
     $film->setDirector($director);
     $film->setProducer($producer);
     $film->setInformations('Some information about the film');
     $film->setFirstFilm(false);
     $film->setColor(true);
     $film->setFormat('dcp');
     $film->setDolbyStereo(true);
     $this->assertEquals('Voici le synopsis du film', $film->getContent('fr')->getSynopsis());
     $this->assertEquals('Here is the film synopsis', $film->getContent('en')->getSynopsis());
     $this->assertEquals('Un long fleuve tranquille', $film->getTitle());
     $this->assertEquals(18, $film->getLengthMin());
     $this->assertEquals(59, $film->getLengthSec());
     $this->assertEquals($datetime, $film->getCompletionDate());
     $this->assertEquals($director, $film->getDirector());
     $this->assertEquals($producer, $film->getProducer());
     $this->assertEquals('Some information about the film', $film->getInformations());
     $this->assertEquals('dcp', $film->getFormat());
     $this->assertTrue($film->isColor());
     $this->assertTrue($film->isDolbyStereo());
     $this->assertFalse($film->isFirstFilm());
 }
 public function onSuccess(Film $film, \RNC\UserBundle\Entity\User $user)
 {
     /* à modifier */
     $film->setUser($user);
     $rep = $this->em->getRepository('RNCFilmBundle:Status');
     $film->setStatus($rep->findOneBy(array('type' => 'waiting')));
     $rep = $this->em->getRepository('RNCFilmBundle:Category');
     $film->setCategory($rep->findOneBy(array('name' => 'none')));
     $this->em->persist($film->getProducer());
     $this->em->persist($film->getDirector());
     $this->em->persist($film->getCategory());
     $this->em->persist($film->getStatus());
     $this->em->persist($film->getUser());
     $this->em->persist($film);
     $this->em->flush();
 }