public function testCreateFromResponse() { $mockResponse = $this->createMockResponse('MockChannelResponse'); $channel = Channel::createFromResponse($mockResponse); $this->assertInstanceOf('BinaryThinking\\LastfmBundle\\Lastfm\\Model\\Channel', $channel, 'object created is not an instance of Channel'); $this->assertNotEmpty($channel->getTitle(), 'title is empty'); $this->assertNotEmpty($channel->getLink(), 'link is empty'); $this->assertNotEmpty($channel->getDescription(), 'description is empty'); $this->assertNotEmpty($channel->getItems(), 'items are empty'); }
/** * Get a podcast of free mp3s based on an artist * * @param string $artist the artist name * @param string $mbid the musicbrainz id for the artist * @param bool $autocorrect transform misspelled artist names into correct artist names */ public function getPodcast($artist, $mbid = null, $autocorrect = true) { $response = $this->call(array('method' => 'artist.getPodcast', 'artist' => $artist, 'mbid' => $mbid, 'autocorrect' => $autocorrect)); $channels = array(); if (!empty($response->rss->channel)) { foreach ($response->rss->channel as $channel) { $channels[] = LastfmModel\Channel::createFromResponse($channel); } } return $channels; }