public function testCreateFromResponse() { $mockResponse = $this->createMockResponse('MockShoutResponse'); $shout = Shout::createFromResponse($mockResponse); $this->assertInstanceOf('BinaryThinking\\LastfmBundle\\Lastfm\\Model\\Shout', $shout, 'object created is not an instance of Shout'); $this->assertNotEmpty($shout->getAuthor(), 'shout author is empty'); $this->assertNotEmpty($shout->getBody(), 'shout body is empty'); $this->assertNotEmpty($shout->getDate(), 'shout date is empty'); }
/** * Get shouts for this album. * * @param string $artist the artist name * @param string $album the album name * @param int $limit the number of results to fetch per page. Defaults to 30. * @param int $page the page number to fetch. Defaults to first page. * @param string $mbid the musicbrainz id for the album * @param bool $autocorrect transform misspelled artist names into correct artist names */ public function getShouts($artist, $album, $limit = null, $page = null, $mbid = null, $autocorrect = true) { $response = $this->call(array('method' => 'album.getShouts', 'artist' => $artist, 'album' => $album, 'mbid' => $mbid, 'limit' => $limit, 'page' => $page, 'autocorrect' => $autocorrect)); $shouts = array(); if (!empty($response->shouts->shout)) { foreach ($response->shouts->shout as $albumShouts) { $shout = LastfmModel\Shout::createFromResponse($albumShouts); $shouts[] = $shout; } } return $shouts; }