コード例 #1
0
 private function createMultimediaObjectAssignedToSeries($title, Series $series)
 {
     $rank = 1;
     $status = MultimediaObject::STATUS_PUBLISHED;
     $record_date = new \DateTime();
     $public_date = new \DateTime();
     $subtitle = 'Subtitle';
     $description = "Description";
     $duration = 0;
     $mm = new MultimediaObject();
     $mm->setStatus($status);
     $mm->setRecordDate($record_date);
     $mm->setPublicDate($public_date);
     $mm->setTitle($title);
     $mm->setSubtitle($subtitle);
     $mm->setDescription($description);
     $mm->setDuration($duration);
     $mm->setSeries($series);
     $this->dm->persist($mm);
     $this->dm->persist($series);
     $this->dm->flush();
     return $mm;
 }
コード例 #2
0
 public function testAddJob()
 {
     $profiles = $this->getDemoProfiles();
     $pathFile = $this->resourcesDir . 'test.txt';
     $profile = 'MASTER_COPY';
     $priority = 2;
     $language = 'es';
     $description = array('en' => 'test', 'es' => 'prueba');
     $series = new Series();
     $multimediaObject = new MultimediaObject();
     $multimediaObject->setSeries($series);
     $this->dm->persist($series);
     $this->dm->persist($multimediaObject);
     $this->dm->flush();
     $this->jobService->addJob($pathFile, $profile, $priority, $multimediaObject, $language, $description);
     $this->assertEquals(1, count($this->repo->findAll()));
     $pathFile2 = $this->resourcesDir . 'test2.txt';
     $profile2 = 'MASTER_VIDEO_H264';
     $priority2 = 3;
     $language2 = 'en';
     $description2 = array('en' => 'test2', 'es' => 'prueba2');
     $this->jobService->addJob($pathFile2, $profile2, $priority2, $multimediaObject, $language2, $description2);
     $this->assertEquals(2, count($this->repo->findAll()));
 }
コード例 #3
0
 public function testCountInSeries()
 {
     $series1 = new Series();
     $series2 = new Series();
     $this->dm->persist($series1);
     $this->dm->persist($series2);
     $this->dm->flush();
     $mm11 = new MultimediaObject();
     $mm12 = new MultimediaObject();
     $mm13 = new MultimediaObject();
     $mm21 = new MultimediaObject();
     $mm22 = new MultimediaObject();
     $mm23 = new MultimediaObject();
     $mm24 = new MultimediaObject();
     $mm11->setSeries($series1);
     $mm12->setSeries($series1);
     $mm13->setSeries($series1);
     $mm21->setSeries($series2);
     $mm22->setSeries($series2);
     $mm23->setSeries($series2);
     $mm24->setSeries($series2);
     $this->dm->persist($mm11);
     $this->dm->persist($mm12);
     $this->dm->persist($mm13);
     $this->dm->persist($mm21);
     $this->dm->persist($mm22);
     $this->dm->persist($mm23);
     $this->dm->persist($mm24);
     $this->dm->flush();
     $this->assertEquals(3, $this->repo->countInSeries($series1));
     $this->assertEquals(4, $this->repo->countInSeries($series2));
 }
コード例 #4
0
 public function testGetterAndSetter()
 {
     $series = new Series();
     $rank = 3;
     $status = MultimediaObject::STATUS_PUBLISHED;
     $record_date = new \DateTime();
     $public_date = new \DateTime();
     $title = 'Star Wars';
     $subtitle = 'Spoiler';
     $description = "Darth Vader: Obi-Wan never told you what happened to your father.\n\t\t\tLuke Skywalker: He told me enough! He told me you killed him!\n\t\t\tDarth Vader: No. I am your father.\n\t\t\tLuke Skywalker: No... that's not true! That's impossible!";
     $numview = 2;
     $locale = 'en';
     $line2 = 'line2';
     $keyword = 'keyword';
     $properties = array('property1', 'property2');
     $tag1 = new Tag();
     $tag1->setCod('tag1');
     $tag2 = new Tag();
     $tag2->setCod('tag2');
     $tag3 = new Tag();
     $tag3->setCod('tag3');
     $mm_tags = array($tag1, $tag2, $tag3);
     $broadcast = new Broadcast();
     $broadcast->setName('Private');
     $broadcast->setBroadcastTypeId(Broadcast::BROADCAST_TYPE_PRI);
     $broadcast->setPasswd('password');
     $broadcast->setDefaultSel(true);
     $broadcast->setDescription('Private broadcast');
     $mm = new MultimediaObject();
     $mm->setRank($rank);
     $mm->setStatus($status);
     $mm->setSeries($series);
     $mm->setRecordDate($record_date);
     $mm->setPublicDate($public_date);
     $mm->setTitle($title);
     $mm->setSubtitle($subtitle);
     $mm->setDescription($description);
     $mm->addTag($tag1);
     $mm->addTag($tag2);
     $mm->addTag($tag3);
     $mm->setBroadcast($broadcast);
     $mm->setNumview($numview);
     $mm->setLocale($locale);
     $mm->setLine2($line2);
     $mm->setKeyword($keyword);
     $mm->setProperties($properties);
     $this->assertEquals($series, $mm->getSeries());
     $this->assertEquals($rank, $mm->getRank());
     $this->assertEquals($status, $mm->getStatus());
     $this->assertEquals($record_date, $mm->getRecordDate());
     $this->assertEquals($public_date, $mm->getPublicDate());
     $this->assertEquals($title, $mm->getTitle());
     $this->assertNotEquals($title . "2", $mm->getTitle());
     $this->assertEquals($subtitle, $mm->getSubtitle());
     $this->assertEquals($description, $mm->getDescription());
     $this->assertEquals(count($mm_tags), count($mm->getTags()));
     $this->assertEquals($broadcast, $mm->getBroadcast());
     $this->assertEquals($numview, $mm->getNumview());
     $this->assertEquals($locale, $mm->getLocale());
     $this->assertEquals($line2, $mm->getLine2());
     $this->assertEquals($keyword, $mm->getKeyword());
     $this->assertEquals($properties, $mm->getProperties());
     $title = null;
     $subtitle = null;
     $description = null;
     $line2 = null;
     $keyword = null;
     $mm->setTitle($title);
     $mm->setSubtitle($subtitle);
     $mm->setDescription($description);
     $mm->setLine2($line2);
     $mm->setKeyword($keyword);
     $this->assertEquals(null, $mm->getTitle());
     $this->assertEquals(null, $mm->getSubtitle());
     $this->assertEquals(null, $mm->getDescription());
     $this->assertEquals(null, $mm->getLine2());
     $this->assertEquals(null, $mm->getKeyword());
     $properties = array('prop2' => 'property2');
     $mm->setProperties($properties);
     $key = 'prop2';
     $this->assertEquals($properties[$key], $mm->getProperty($key));
     $property3 = 'property3';
     $value3 = 'value3';
     $mm->setProperty($property3, $value3);
     $this->assertEquals($value3, $mm->getProperty($property3));
     $mm->removeProperty($property3);
     $this->assertNull($mm->getProperty($property3));
 }
コード例 #5
0
 /**
  * Create a new Multimedia Object from Template
  *
  * @return MultimediaObject
  */
 public function createMultimediaObject($series)
 {
     $prototype = $this->getMultimediaObjectPrototype($series);
     if (null !== $prototype) {
         $mm = $this->createMultimediaObjectFromPrototype($prototype);
     } else {
         $mm = new MultimediaObject();
         foreach ($this->locales as $locale) {
             $title = $this->translator->trans(self::DEFAULT_MULTIMEDIAOBJECT_TITLE, array(), null, $locale);
             $mm->setTitle($title, $locale);
         }
         $broadcast = $this->getDefaultBroadcast();
         if ($broadcast) {
             $mm->setBroadcast($broadcast);
             $this->dm->persist($broadcast);
         }
     }
     $mm->setPublicDate(new \DateTime("now"));
     $mm->setRecordDate($mm->getPublicDate());
     $mm->setStatus(MultimediaObject::STATUS_BLOQ);
     $mm->setSeries($series);
     $this->dm->persist($mm);
     $this->dm->persist($series);
     $this->dm->flush();
     return $mm;
 }