Esempio n. 1
0
 public function testWeeklyArtistChartList()
 {
     try {
         $as = new Zend_Service_Audioscrobbler();
         $as->set('group', urlencode('Jazz Club'));
         $response = $as->groupGetWeeklyArtistChartList();
         $this->assertNotNull($response);
         $this->assertNotNull($response->chart);
         $this->assertEquals($response['group'], 'Jazz Club');
         return;
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }
Esempio n. 2
0
    public function testWeeklyArtistChartList()
    {
        try {
            $testing_response = $this->header . '<?xml version="1.0" encoding="UTF-8"?>
<weeklyartistchart group="Jazz Club" from="1172404800" to="1173009600">
<artist>
    <name>Miles Davis</name>
    <mbid>561d854a-6a28-4aa7-8c99-323e6ce46c2a</mbid>
    <chartposition>1</chartposition>
    <reach>194</reach>
    <url>http://www.last.fm/music/Miles+Davis</url>
</artist>
<artist>
    <name>The Beatles</name>
    <mbid>b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d</mbid>
    <chartposition>2</chartposition>
    <reach>156</reach>
    <url>http://www.last.fm/music/The+Beatles</url>
</artist>
<artist>
    <name>Pink Floyd</name>
    <mbid>83d91898-7763-47d7-b03b-b92132375c47</mbid>
    <chartposition>3</chartposition>
    <reach>132</reach>
    <url>http://www.last.fm/music/Pink+Floyd</url>
</artist>
<artist>
    <name>John Coltrane</name>
    <mbid>b625448e-bf4a-41c3-a421-72ad46cdb831</mbid>
    <chartposition>4</chartposition>
    <reach>124</reach>
    <url>http://www.last.fm/music/John+Coltrane</url>
</artist>
<artist>
    <name>Radiohead</name>
    <mbid>a74b1b7f-71a5-4011-9441-d0b5e4122711</mbid>
    <chartposition>4</chartposition>
    <reach>124</reach>
    <url>http://www.last.fm/music/Radiohead</url>
</artist>
<artist>
    <name>Herbie Hancock</name>
    <mbid>27613b78-1b9d-4ec3-9db5-fa0743465fdd</mbid>
    <chartposition>6</chartposition>
    <reach>106</reach>
    <url>http://www.last.fm/music/Herbie+Hancock</url>
</artist>
<artist>
    <name>Led Zeppelin</name>
    <mbid>678d88b2-87b0-403b-b63d-5da7465aecc3</mbid>
    <chartposition>7</chartposition>
    <reach>104</reach>
    <url>http://www.last.fm/music/Led+Zeppelin</url>
</artist>
<artist>
    <name>David Bowie</name>
    <mbid>5441c29d-3602-4898-b1a1-b77fa23b8e50</mbid>
    <chartposition>8</chartposition>
    <reach>102</reach>
    <url>http://www.last.fm/music/David+Bowie</url>
</artist>
<artist>
    <name>AIR</name>
    <mbid>cb67438a-7f50-4f2b-a6f1-2bb2729fd538</mbid>
    <chartposition>9</chartposition>
    <reach>96</reach>
    <url>http://www.last.fm/music/AIR</url>
</artist>
<artist>
    <name>Red Hot Chili Peppers</name>
    <mbid>8bfac288-ccc5-448d-9573-c33ea2aa5c30</mbid>
    <chartposition>9</chartposition>
    <reach>96</reach>
    <url>http://www.last.fm/music/Red+Hot+Chili+Peppers</url>
</artist>
</weeklyartistchart>
';
            $as = new Zend_Service_Audioscrobbler(TRUE, $testing_response);
            $as->set('group', urlencode('Jazz Club'));
            $response = $as->groupGetWeeklyArtistChartList();
            $this->assertNotNull(count($response));
            $artist = $response->artist[1];
            $this->assertEquals((string) $artist->name, 'The Beatles');
            $this->assertEquals((string) $artist->url, 'http://www.last.fm/music/The+Beatles');
            $this->assertEquals((string) $response['group'], 'Jazz Club');
            return;
        } catch (Exception $e) {
            $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
        }
    }