Exemplo n.º 1
0
 /**
  * @param array $featureds
  *
  * @return array
  */
 public function createFeaturedStreams(array $featureds)
 {
     $tmp = [];
     foreach ($featureds as $entry) {
         $featured = FeaturedStream::create();
         if (isset($entry['stream'])) {
             $featured->setStream((new StreamFactory())->createEntity($entry['stream']));
         }
         if (isset($entry['image'])) {
             $featured->setImage($entry['image']);
         }
         if (isset($entry['text'])) {
             $featured->setText($entry['text']);
         }
         if (isset($entry['title'])) {
             $featured->setTitle($entry['title']);
         }
         if (isset($entry['sponsored'])) {
             $featured->setSponsored($entry['sponsored']);
         }
         if (isset($entry['scheduled'])) {
             $featured->setScheduled($entry['scheduled']);
         }
         $tmp[] = $featured;
     }
     return $tmp;
 }
 /**
  * Test Get/Set, create, endpoint methods.
  */
 public function testFeaturedStreamEntity()
 {
     $featured = FeaturedStream::create();
     $this->assertInstanceOf('Shoko\\TwitchApiBundle\\Model\\Entity\\FeaturedStream', $featured);
     $this->assertEquals(null, $featured->getImage());
     $this->assertEquals('some_image', $featured->setImage('some_image')->getImage());
     $this->assertEquals(null, $featured->getText());
     $this->assertEquals('some_text', $featured->setText('some_text')->getText());
     $this->assertEquals(null, $featured->getTitle());
     $this->assertEquals('some_titlee', $featured->setTitle('some_titlee')->getTitle());
     $this->assertEquals(false, $featured->isSponsored());
     $this->assertEquals(true, $featured->setSponsored(true)->isSponsored());
     $this->assertEquals(false, $featured->isScheduled());
     $this->assertEquals(true, $featured->setScheduled(true)->isScheduled());
 }