Esempio n. 1
0
 public function testTopAlbums()
 {
     try {
         $as = new Zend_Service_Audioscrobbler();
         $as->set('artist', 'Metallica');
         $response = $as->artistGetTopAlbums();
         $this->assertNotNull($response->topalbums);
         $this->assertEquals($response['artist'], 'Metallica');
         $this->assertNotNull($response->album);
         return;
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }
Esempio n. 2
0
 public function testTopAlbums()
 {
     try {
         $test_response = $this->header . '<?xml version="1.0" encoding="UTF-8"?>
                         <topalbums artist="Metallica">
                         <album>
                             <name>Master of Puppets</name>
                             <mbid>fed37cfc-2a6d-4569-9ac0-501a7c7598eb</mbid>
                             <reach>28940</reach>
                             <url>http://www.last.fm/music/Metallica/Master+of+Puppets</url>
                             <releasedate>7 Oct 1986, 00:00</releasedate>
                             <coverart>
                                 <small>http://static.last.fm/coverart/50x50/1411810.jpg</small>
                                 <medium>http://static.last.fm/coverart/130x130/1411810.jpg</medium>
                                 <large>http://static.last.fm/coverart/300x300/1411810.jpg</large>
                             </coverart>
                         </album>
                         <album>
                             <name>Reload</name>
                             <mbid>b05cf8e3-67ad-4d40-9dc1-3a697e3a1bf8</mbid>
                             <reach>27226</reach>
                             <url>http://www.last.fm/music/Metallica/Reload</url>
                             <releasedate>18 Nov 1997, 00:00</releasedate>
                             <coverart>
                                 <small>http://images.amazon.com/images/P/B000002HRE.01._SCMZZZZZZZ_.jpg</small>
                                 <medium>http://images.amazon.com/images/P/B000002HRE.01._SCMZZZZZZZ_.jpg</medium>
                                 <large>http://images.amazon.com/images/P/B000002HRE.01._SCMZZZZZZZ_.jpg</large>
                             </coverart>
                         </album>
                         </topalbums>
                         ';
         $as = new Zend_Service_Audioscrobbler(TRUE, $test_response);
         $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');
         return;
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }