Esempio n. 1
0
 public function testGetTopTracks()
 {
     try {
         $as = new Zend_Service_Audioscrobbler();
         $as->set('tag', 'Rock');
         $response = $as->tagGetTopTracks();
         $this->assertNotNull($response->track);
         $this->assertNotNull($response->artist);
         $this->assertEquals($response['tag'], strtolower($as->get('tag')));
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }
Esempio n. 2
0
    public function testGetTopTracks()
    {
        try {
            $testing_response = $this->header . '<?xml version="1.0" encoding="UTF-8"?>
<tag tag="rock" count="785836">
<track name="Dani California" count="295" streamable="yes">
        <artist name="Red Hot Chili Peppers">
        <mbid>8bfac288-ccc5-448d-9573-c33ea2aa5c30</mbid>
        <url>http://www.last.fm/music/Red+Hot+Chili+Peppers</url>
    </artist>
    <url>http://www.last.fm/music/Red+Hot+Chili+Peppers/_/Dani+California</url>
</track>
<track name="Wonderwall" count="290" streamable="yes">
        <artist name="Oasis">
        <mbid>39ab1aed-75e0-4140-bd47-540276886b60</mbid>
        <url>http://www.last.fm/music/Oasis</url>
    </artist>
    <url>http://www.last.fm/music/Oasis/_/Wonderwall</url>
</track>
<track name="Boulevard of Broken Dreams" count="271" streamable="yes">
        <artist name="Green Day">
        <mbid></mbid>
        <url>http://www.last.fm/music/Green+Day</url>
    </artist>
    <url>http://www.last.fm/music/Green+Day/_/Boulevard+of+Broken+Dreams</url>
</track>
</tag>
';
            $as = new Zend_Service_Audioscrobbler(TRUE, $testing_response);
            $as->set('tag', 'Rock');
            $response = $as->tagGetTopTracks();
            $artist = $response->track[0];
            $this->assertNotNull(count($response->track));
            $this->assertNotNull((string) $artist->name);
            $this->assertEquals((string) $response['tag'], strtolower($as->get('tag')));
        } catch (Exception $e) {
            $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
        }
    }