예제 #1
0
 public function testUserGetPreviousWeeklyTrackChart()
 {
     try {
         $testing_response = "HTTP/1.1 200 OK\r\nContent-type: text/xml\r\n\r\n" . '<?xml version="1.0" encoding="UTF-8"?>
                             <weeklytrackchart user="******" from="1114965332" to="1115570132">
                                 <track>
                                         <artist mbid="f73b2b70-33d5-4118-923b-05ba8ad7e702">The Kleptones</artist>
                                     <name>Question</name>
                                     <mbid></mbid>
                                     <chartposition>1</chartposition>
                                     <playcount>3</playcount>
                                             <url>http://www.last.fm/music/The+Kleptones/_/Question</url>
                                 </track>
                                 <track>
                                         <artist mbid="b7ffd2af-418f-4be2-bdd1-22f8b48613da">Nine Inch Nails</artist>
                                     <name>All the Love in the World</name>
                                     <mbid></mbid>
                                     <chartposition>2</chartposition>
                                     <playcount>2</playcount>
                                             <url>http://www.last.fm/music/Nine+Inch+Nails/_/All+the+Love+in+the+World</url>
                                 </track>
                             </weeklytrackchart>';
         $as = new Zend_Service_Audioscrobbler(true, $testing_response);
         $as->set('user', 'RJ');
         $from = 1114965332;
         $to = 1115570132;
         $response = $as->userGetWeeklyTrackChart($from, $to);
         $track = $response->track[0];
         $this->assertEquals((string) $response['user'], 'RJ');
         $this->assertEquals((int) $response['from'], $from);
         $this->assertEquals((int) $response['to'], $to);
         $this->assertEquals((string) $track->artist, 'The Kleptones');
         $this->assertEquals(count($response->track), 2);
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }
예제 #2
0
 public function testUserGetPreviousWeeklyTrackChart()
 {
     try {
         $as = new Zend_Service_Audioscrobbler();
         $as->set('user', 'RJ');
         $from = 1114965332;
         $to = 1115570132;
         $response = $as->userGetWeeklyTrackChart($from, $to);
         $this->assertEquals($response['user'], 'RJ');
         $this->assertEquals($response['from'], 1114965332);
         $this->assertEquals($response['to'], 1115570132);
         $this->assertNotNull($response->weeklytrackchart);
         $this->assertNotNull($response->track);
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }