private function createBroadcast($broadcastTypeId, $name)
 {
     $locale = 'en';
     $passwd = 'password';
     $defaultSel = $broadcastTypeId == Broadcast::BROADCAST_TYPE_PRI;
     $description = ucfirst($broadcastTypeId) . ' broadcast';
     $broadcast = new Broadcast();
     $broadcast->setLocale($locale);
     $broadcast->setName($name);
     $broadcast->setBroadcastTypeId($broadcastTypeId);
     $broadcast->setPasswd($passwd);
     $broadcast->setDefaultSel($defaultSel);
     $broadcast->setDescription($description);
     $this->dm->persist($broadcast);
     $this->dm->flush();
     return $broadcast;
 }
Ejemplo n.º 2
0
 private function createBroadcast($broadcastTypeId)
 {
     $broadcast = new Broadcast();
     $broadcast->setName(ucfirst($broadcastTypeId));
     $broadcast->setBroadcastTypeId($broadcastTypeId);
     $broadcast->setPasswd('password');
     if (0 === strcmp(Broadcast::BROADCAST_TYPE_PRI, $broadcastTypeId)) {
         $broadcast->setDefaultSel(true);
     } else {
         $broadcast->setDefaultSel(false);
     }
     $broadcast->setDescription(ucfirst($broadcastTypeId) . ' broadcast');
     $this->dm->persist($broadcast);
     $this->dm->flush();
     return $broadcast;
 }
Ejemplo n.º 3
0
 private function createBroadcast($broadcastTypeId)
 {
     $locale = 'en';
     $name = ucfirst($broadcastTypeId);
     $passwd = 'password';
     $defaultSel = true;
     $descriptionEn = ucfirst($broadcastTypeId) . ' broadcast';
     $broadcast = new Broadcast();
     $broadcast->setLocale($locale);
     $broadcast->setName($name);
     $broadcast->setBroadcastTypeId($broadcastTypeId);
     $broadcast->setPasswd($passwd);
     $broadcast->setDefaultSel($defaultSel);
     $broadcast->setDescription($descriptionEn, $locale);
     return $broadcast;
 }
 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));
 }
 /**
  * Create Broadcast from CSV array
  */
 private function createBroadcastFromCsvArray($csv_array)
 {
     $broadcast = new Broadcast();
     $broadcast->setName($csv_array[1]);
     if (in_array($csv_array[2], array(Broadcast::BROADCAST_TYPE_PUB, Broadcast::BROADCAST_TYPE_PRI, Broadcast::BROADCAST_TYPE_COR))) {
         $broadcast->setBroadcastTypeId($csv_array[2]);
     } else {
         $broadcast->setBroadcastTypeId(Broadcast::BROADCAST_TYPE_PRI);
     }
     $broadcast->setPasswd($csv_array[3]);
     $broadcast->setDefaultSel($csv_array[4]);
     // NOTE Take care of csv language order!
     if (isset($csv_array[5])) {
         $broadcast->setDescription($csv_array[5], 'es');
     }
     if (isset($csv_array[6])) {
         $broadcast->setDescription($csv_array[6], 'gl');
     }
     if (isset($csv_array[7])) {
         $broadcast->setDescription($csv_array[7], 'en');
     }
     $this->dm->persist($broadcast);
     return $broadcast;
 }