Esempio n. 1
0
 public function testGetRelatedArtists()
 {
     try {
         $as = new Zend_Service_Audioscrobbler();
         $as->set('artist', 'Metallica');
         $response = $as->artistGetRelatedArtists();
         $this->assertNotNull($response);
         $this->assertNotNull($response->similarartists);
         $this->assertNotNull($response->artist);
         return;
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }
Esempio n. 2
0
    public function testGetRelatedArtists()
    {
        try {
            $test_response = $this->header .
                            '<?xml version="1.0" encoding="UTF-8"?>
                            <similarartists artist="Metallica" streamable="1" picture="http://static.last.fm/proposedimages/sidebar/6/1000024/1285.jpg" mbid="65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab">
                            <artist>
                                <name>Iron Maiden</name>
                                <mbid>ca891d65-d9b0-4258-89f7-e6ba29d83767</mbid>
                                <match>100</match>
                                <url>http://www.last.fm/music/Iron+Maiden</url>
                                <image_small>http://static.last.fm/proposedimages/thumbnail/6/1000107/459375.jpg</image_small>
                                <image>http://static.last.fm/proposedimages/sidebar/6/1000107/459375.jpg</image>
                                <streamable>1</streamable>
                            </artist>
                            <artist>
                                <name>System of a Down</name>
                                <mbid>cc0b7089-c08d-4c10-b6b0-873582c17fd6</mbid>
                                <match>96</match>
                                <url>http://www.last.fm/music/System+of+a+Down</url>
                                <image_small>http://static.last.fm/proposedimages/thumbnail/6/4468/52383.jpg</image_small>
                                <image>http://static.last.fm/proposedimages/sidebar/6/4468/52383.jpg</image>
                                <streamable>1</streamable>
                            </artist>
                            </similarartists>';
            $as = new Zend_Service_Audioscrobbler(TRUE, $test_response);
            $as->set('artist', 'Metallica');
            $response = $as->artistGetRelatedArtists();
            $artist = $response->artist[0];
            $this->assertEquals(count($response->artist), 2);
            $this->assertEquals((string)$artist->name, 'Iron Maiden');
            $this->assertEquals((string)$response['artist'], 'Metallica');
            return;
        } catch (Exception $e ) {
            $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
        }

    }