Esempio n. 1
0
 public function testUserGetPreviousWeeklyAlbumChart()
 {
     try {
         $testing_response = "HTTP/1.1 200 OK\r\nContent-type: text/xml\r\n\r\n" . '<?xml version="1.0" encoding="UTF-8"?>
                             <weeklyalbumchart user="******" from="1114965332" to="1115570132">
                             <album>
                                 <artist mbid="9efff43b-3b29-4082-824e-bc82f646f93d">The Doors</artist>
                                 <name>The Doors Box Set</name>
                                 <mbid></mbid>
                                 <chartposition>1</chartposition>
                                 <playcount>2</playcount>
                                 <url>http://www.last.fm/music/The+Doors/The+Doors+Box+Set</url>
                             </album>
                             <album>
                                 <artist mbid="5b11f4ce-a62d-471e-81fc-a69a8278c7da">Nirvana</artist>
                                 <name>Nirvana</name>
                                 <mbid>d8f9547d-5e46-45f0-b694-0d9af9e2de63</mbid>
                                 <chartposition>1</chartposition>
                                 <playcount>2</playcount>
                                 <url>http://www.last.fm/music/Nirvana/Nirvana</url>
                             </album>
                             </weeklyalbumchart>';
         $as = new Zend_Service_Audioscrobbler(true, $testing_response);
         $as->set('user', 'RJ');
         $from = 1114965332;
         $to = 1115570132;
         $response = $as->userGetWeeklyAlbumChart($from, $to);
         $album = $response->album[0];
         $this->assertEquals((string) $response['user'], 'RJ');
         $this->assertEquals((int) $response['from'], 1114965332);
         $this->assertEquals((int) $response['to'], 1115570132);
         $this->assertEquals(count($response->album), 2);
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }
Esempio n. 2
0
 public function testUserGetPreviousWeeklyAlbumChart()
 {
     try {
         $as = new Zend_Service_Audioscrobbler();
         $as->set('user', 'RJ');
         $from = 1114965332;
         $to = 1115570132;
         $response = $as->userGetWeeklyAlbumChart($from, $to);
         $this->assertEquals($response['user'], 'RJ');
         $this->assertEquals($response['from'], 1114965332);
         $this->assertEquals($response['to'], 1115570132);
         $this->assertNotNull($response->weeklyartistchart);
         $this->assertNotNull($response->album);
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }