Ejemplo n.º 1
0
 /**
  * Handle Genres
  *
  * @param Show  $show
  * @param array $genres
  * @return void
  * @throws \InvalidArgumentException
  */
 protected function handleGenres(Show $show, $genres)
 {
     if (empty($genres)) {
         return;
     }
     if (!is_array($genres) || !array_key_exists('genre', $genres)) {
         return;
     }
     if (is_string($genres['genre'])) {
         $show->addGenre($genres['genre']);
     } elseif (is_array($genres['genre'])) {
         foreach ($genres['genre'] as $genre) {
             if (!empty($genre)) {
                 $show->addGenre($genre);
             }
         }
     }
 }
Ejemplo n.º 2
0
 public function showTest(Show $test)
 {
     $this->assertEquals(2930, $test->getShowId());
     $this->assertInternalType('int', $test->getShowId());
     $this->assertEquals('Buffy the Vampire Slayer', $test->getName());
     $this->assertInternalType('string', $test->getName());
     $this->assertEquals('http://tvrage.com/Buffy_The_Vampire_Slayer', $test->getLink());
     $this->assertInternalType('string', $test->getLink());
     $this->assertEquals('US', $test->getCountry());
     $this->assertInternalType('string', $test->getCountry());
     $this->assertTrue($test->isEnded());
     $this->assertInternalType('bool', $test->isEnded());
     $this->assertEquals(7, $test->getSeasonCount());
     $this->assertInternalType('int', $test->getSeasonCount());
     $this->assertEquals('Ended', $test->getStatus());
     $this->assertInternalType('string', $test->getStatus());
     $this->assertEquals('Scripted', $test->getClassification());
     $this->assertInternalType('string', $test->getClassification());
     $this->assertInternalType('array', $test->getGenres());
     $this->assertContainsOnly('string', $test->getGenres());
     $this->assertContains('Comedy', $test->getGenres());
 }