header . ' Iron Maiden ca891d65-d9b0-4258-89f7-e6ba29d83767 100 http://www.last.fm/music/Iron+Maiden http://static.last.fm/proposedimages/thumbnail/6/1000107/459375.jpg http://static.last.fm/proposedimages/sidebar/6/1000107/459375.jpg 1 System of a Down cc0b7089-c08d-4c10-b6b0-873582c17fd6 96 http://www.last.fm/music/System+of+a+Down http://static.last.fm/proposedimages/thumbnail/6/4468/52383.jpg http://static.last.fm/proposedimages/sidebar/6/4468/52383.jpg 1 '; $this->setAudioscrobblerResponse($getRelatedArtistsResponse); $as = $this->getAudioscrobblerService(); $as->set('artist', 'Metallica'); $response = $as->artistGetRelatedArtists(); $artist = $response->artist[0]; $this->assertEquals(count($response->artist), 2); $this->assertEquals((string)$artist->name, 'Iron Maiden'); $this->assertEquals((string)$response['artist'], 'Metallica'); } public function testGetFans() { $getFansResponse = $this->header . ' http://www.last.fm/user/Liquid_Fire/ http://static.last.fm/avatar/d8d9af8246e537078a57d5dc826cb34a.gif 617010250 http://www.last.fm/user/CeciltheDark/ http://static.last.fm/avatar/30f0417393b696ac2ea06213bc5777d9.png 382812500 '; $this->setAudioscrobblerResponse($getFansResponse); $as = $this->getAudioscrobblerService(); $as->set('artist', 'Metallica'); $response = $as->artistGetTopFans(); $user = $response->user[0]; $this->assertEquals((string)$response['artist'], 'Metallica'); $this->assertEquals((string)$user->url, 'http://www.last.fm/user/Liquid_Fire/'); } public function testTopTracks() { $getTopTracksResponse = $this->header . ' Nothing Else Matters 7481 http://www.last.fm/music/Metallica/_/Nothing+Else+Matters Enter Sandman 7139 http://www.last.fm/music/Metallica/_/Enter+Sandman '; $this->setAudioscrobblerResponse($getTopTracksResponse); $as = $this->getAudioscrobblerService(); $as->set('artist', 'Metallica'); $response = $as->artistGetTopTracks(); $track = $response->track[0]; $this->assertEquals((string)$response['artist'], 'Metallica'); $this->assertEquals((string)$track->name, 'Nothing Else Matters'); $this->assertEquals((int)$track->reach, 7481); } public function testTopAlbums() { $getTopAlbumsResponse = $this->header . ' Master of Puppets fed37cfc-2a6d-4569-9ac0-501a7c7598eb 28940 http://www.last.fm/music/Metallica/Master+of+Puppets 7 Oct 1986, 00:00 http://static.last.fm/coverart/50x50/1411810.jpg http://static.last.fm/coverart/130x130/1411810.jpg http://static.last.fm/coverart/300x300/1411810.jpg Reload b05cf8e3-67ad-4d40-9dc1-3a697e3a1bf8 27226 http://www.last.fm/music/Metallica/Reload 18 Nov 1997, 00:00 http://images.amazon.com/images/P/B000002HRE.01._SCMZZZZZZZ_.jpg http://images.amazon.com/images/P/B000002HRE.01._SCMZZZZZZZ_.jpg http://images.amazon.com/images/P/B000002HRE.01._SCMZZZZZZZ_.jpg '; $this->setAudioscrobblerResponse($getTopAlbumsResponse); $as = $this->getAudioscrobblerService(); $as->set('artist', 'Metallica'); $response = $as->artistGetTopAlbums(); $album = $response->album[0]; $this->assertEquals((string)$response['artist'], 'Metallica'); $this->assertEquals((string)$album->name, 'Master of Puppets'); $this->assertEquals((string)$album->coverart->small, 'http://static.last.fm/coverart/50x50/1411810.jpg'); } public function testTopTags() { $test_response = $this->header . ' metal 100 http://www.last.fm/tag/metal heavy metal 24 http://www.last.fm/tag/heavy%20metal thrash metal 18 http://www.last.fm/tag/thrash%20metal '; $this->setAudioscrobblerResponse($test_response); $as = $this->getAudioscrobblerService(); $as->set('artist', 'Metallica'); $response = $as->artistGetTopTags(); $tag = $response->tag[0]; $this->assertEquals((string)$response['artist'], 'Metallica'); $this->assertEquals((string)$tag->name, 'metal'); $this->assertEquals((int)$tag->count, 100); } }