Esempio n. 1
0
 public function testUserGetPreviousWeeklyArtistChart()
 {
     try {
         $testing_response = "HTTP/1.1 200 OK\r\nContent-type: text/xml\r\n\r\n" . '<?xml version="1.0" encoding="UTF-8"?>
                             <weeklyartistchart user="******" from="1114965332" to="1115570132">
                             <artist>
                                 <name>Nine Inch Nails</name>
                                 <mbid>b7ffd2af-418f-4be2-bdd1-22f8b48613da</mbid>
                                 <chartposition>1</chartposition>
                                 <playcount>23</playcount>
                                     <url>http://www.last.fm/music/Nine+Inch+Nails</url>
                             </artist>
                             <artist>
                                 <name>The Doors</name>
                                 <mbid>9efff43b-3b29-4082-824e-bc82f646f93d</mbid>
                                 <chartposition>2</chartposition>
                                 <playcount>3</playcount>
                                     <url>http://www.last.fm/music/The+Doors</url>
                             </artist>
                             </weeklyartistchart>';
         $as = new Zend_Service_Audioscrobbler(true, $testing_response);
         $as->set('user', 'RJ');
         $from = 1114965332;
         $to = 1115570132;
         $response = $as->userGetWeeklyArtistChart($from, $to);
         $artist = $response->artist[0];
         $this->assertEquals((string) $response['user'], 'RJ');
         $this->assertEquals((int) $response['from'], $from);
         $this->assertEquals((int) $response['to'], $to);
         $this->assertEquals((string) $artist->name, 'Nine Inch Nails');
         $this->assertEquals(count($response->artist), 2);
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }
Esempio n. 2
0
 public function testUserGetPreviousWeeklyArtistChart()
 {
     try {
         $as = new Zend_Service_Audioscrobbler();
         $as->set('user', 'RJ');
         $from = 1114965332;
         $to = 1115570132;
         $response = $as->userGetWeeklyArtistChart($from, $to);
         $this->assertEquals($response['user'], 'RJ');
         $this->assertEquals($response['from'], 1114965332);
         $this->assertEquals($response['to'], 1115570132);
         $this->assertNotNull($response->weeklyartistchart);
         $this->assertNotNull($response->artist);
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }