Exemplo n.º 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;
 }
 public function testRepository()
 {
     //$rank = 1;
     $status = MultimediaObject::STATUS_PUBLISHED;
     $record_date = new \DateTime();
     $public_date = new \DateTime();
     $title = 'titulo cualquiera';
     $subtitle = 'Subtitle paragraph';
     $description = "Description text";
     $duration = 300;
     $broadcast = $this->createBroadcast(Broadcast::BROADCAST_TYPE_PRI);
     $mmobj = new MultimediaObject();
     //$mmobj->setRank($rank);
     $mmobj->setStatus($status);
     $mmobj->setRecordDate($record_date);
     $mmobj->setPublicDate($public_date);
     $mmobj->setTitle($title);
     $mmobj->setSubtitle($subtitle);
     $mmobj->setDescription($description);
     $mmobj->setDuration($duration);
     $mmobj->setBroadcast($broadcast);
     $this->dm->persist($mmobj);
     $this->dm->flush();
     $this->assertEquals(1, count($this->repo->findAll()));
     $this->assertEquals($broadcast, $mmobj->getBroadcast());
     $broadcast = $this->createBroadcast(Broadcast::BROADCAST_TYPE_PUB);
     $mmobj->setBroadcast($broadcast);
     $this->dm->persist($mmobj);
     $this->dm->flush();
     $this->assertEquals($broadcast, $mmobj->getBroadcast());
     $t1 = new Track();
     $t1->setTags(array('master'));
     $t2 = new Track();
     $t2->setTags(array('mosca', 'master', 'old'));
     $t3 = new Track();
     $t3->setTags(array('master', 'mosca'));
     $t4 = new Track();
     $t4->setTags(array('flv', 'itunes', 'hide'));
     $t5 = new Track();
     $t5->setTags(array('flv', 'webtv'));
     $t6 = new Track();
     $t6->setTags(array('track6'));
     $t6->setHide(true);
     $this->dm->persist($t1);
     $this->dm->persist($t2);
     $this->dm->persist($t3);
     $this->dm->persist($t4);
     $this->dm->persist($t5);
     $this->dm->persist($t6);
     $mmobj->addTrack($t3);
     $mmobj->addTrack($t2);
     $mmobj->addTrack($t1);
     $mmobj->addTrack($t4);
     $mmobj->addTrack($t5);
     $mmobj->addTrack($t6);
     $this->dm->persist($mmobj);
     $this->dm->flush();
     $this->assertEquals(5, count($mmobj->getFilteredTracksWithTags()));
     $this->assertEquals(3, count($mmobj->getFilteredTracksWithTags(array('master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTracksWithTags(array('master'), array('mosca', 'old'))));
     $this->assertEquals(0, count($mmobj->getFilteredTracksWithTags(array(), array('mosca', 'old'), array('master'))));
     $this->assertEquals(3, count($mmobj->getFilteredTracksWithTags(array(), array(), array('flv'))));
     $this->assertEquals(0, count($mmobj->getFilteredTracksWithTags(array(), array(), array('flv', 'master'))));
     $this->assertEquals(5, count($mmobj->getFilteredTracksWithTags(array(), array(), array(), array('flv', 'master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTracksWithTags(array('mosca', 'old'), array(), array(), array('old'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags()));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array('master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array('master'), array('mosca', 'old'))));
     $this->assertEquals(0, count($mmobj->getFilteredTrackWithTags(array(), array('mosca', 'old'), array('master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array(), array(), array('flv'))));
     $this->assertEquals(0, count($mmobj->getFilteredTrackWithTags(array(), array(), array('flv', 'master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array(), array(), array(), array('flv', 'master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array('mosca', 'old'), array(), array(), array('old'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array(), array(), array(), array('master', 'mosca'))));
     $this->assertEquals(null, count($mmobj->getFilteredTrackWithTags(array('track6'))));
     $this->assertEquals(null, count($mmobj->getFilteredTracksWithTags(array('track6'))));
 }
 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));
 }
 private function createTestMultimediaObject()
 {
     $status = MultimediaObject::STATUS_PUBLISHED;
     $record_date = new \DateTime();
     $public_date = new \DateTime();
     $title = 'titulo cualquiera';
     $subtitle = 'Subtitle paragraph';
     $description = "Description text";
     $duration = 300;
     $mmobj = new MultimediaObject();
     $mmobj->setStatus($status);
     $mmobj->setRecordDate($record_date);
     $mmobj->setPublicDate($public_date);
     $mmobj->setTitle($title);
     $mmobj->setSubtitle($subtitle);
     $mmobj->setDescription($description);
     $mmobj->setDuration($duration);
     $this->dm->persist($mmobj);
     $this->dm->flush();
 }
Exemplo n.º 5
0
 private function createMultimediaObject($title, $prototype = false)
 {
     $locale = 'en';
     $status = $prototype ? MultimediaObject::STATUS_PROTOTYPE : MultimediaObject::STATUS_NEW;
     $record_date = new \DateTime();
     $public_date = new \DateTime();
     $subtitle = 'Subtitle paragraph';
     $description = "Description text";
     $duration = 300;
     $mmobj = new MultimediaObject();
     $mmobj->setLocale($locale);
     $mmobj->setStatus($status);
     $mmobj->setRecordDate($record_date);
     $mmobj->setPublicDate($public_date);
     $mmobj->setTitle($title);
     $mmobj->setSubtitle($subtitle);
     $mmobj->setDescription($description);
     $mmobj->setDuration($duration);
     $this->dm->persist($mmobj);
     $this->dm->flush();
     return $mmobj;
 }
Exemplo n.º 6
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;
 }