Esempio n. 1
0
 public function testUserGetTopTracks()
 {
     try {
         $as = new Zend_Service_Audioscrobbler();
         $as->set('user', 'RJ');
         $response = $as->userGetTopTracks();
         $this->assertEquals($response['user'], 'RJ');
         $this->assertNotNull($response->track);
     } catch (Exception $e) {
         $this->fail("Exception: [{$e->getMessage}()] thrown by test");
     }
 }
Esempio n. 2
0
 public function testUserGetTopTracks()
 {
     try {
         $testing_response = "HTTP/1.1 200 OK\r\n" . "Content-type: text/xml\r\n" . "\r\n" . '<?xml version="1.0" encoding="UTF-8"?>
                         <toptracks user="******">
                         <track>
                                 <artist mbid="12ff8858-bfcb-4812-a8dd-7e9debf0cbee">Steppenwolf</artist>
                             <name>The Pusher</name>
                             <mbid></mbid>
                             <playcount>31</playcount>
                             <rank>1</rank>
                             <url>http://www.last.fm/music/Steppenwolf/_/The+Pusher</url>
                         </track>
                         <track>
                                 <artist mbid="8f6bd1e4-fbe1-4f50-aa9b-94c450ec0f11">Portishead</artist>
                             <name>Cowboys</name>
                             <mbid></mbid>
                             <playcount>28</playcount>
                             <rank>2</rank>
                             <url>http://www.last.fm/music/Portishead/_/Cowboys</url>
                         </track>
                         </toptracks>';
         $as = new Zend_Service_Audioscrobbler(true, $testing_response);
         $as->set('user', 'RJ');
         $response = $as->userGetTopTracks();
         $track = $response->track[0];
         $this->assertEquals((string) $response['user'], 'RJ');
         $this->assertNotNull($track);
         $this->assertEquals((string) $track->artist, 'Steppenwolf');
         $this->assertEquals((int) $track->playcount, 31);
     } catch (Exception $e) {
         $this->fail("Exception: [{$e}] thrown by test");
     }
 }