Esempio n. 1
0
 public function testTopTags()
 {
     try {
         $as = new Zend_Service_Audioscrobbler();
         $as->set('artist', 'Metallica');
         $response = $as->artistGetTopTags();
         $this->assertNotNull($response->toptags);
         $this->assertEquals($response['artist'], 'Metallica');
         $this->assertNotNull($response->tag);
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }
Esempio n. 2
0
 public function testTopTags()
 {
     try {
         $test_response = $this->header . '<?xml version="1.0" encoding="UTF-8"?>
                         <toptags artist="Metallica">
                         <tag>
                             <name>metal</name>
                             <count>100</count>
                             <url>http://www.last.fm/tag/metal</url>
                         </tag>
                         <tag>
                             <name>heavy metal</name>
                             <count>24</count>
                             <url>http://www.last.fm/tag/heavy%20metal</url>
                         </tag>
                         <tag>
                             <name>thrash metal</name>
                             <count>18</count>
                             <url>http://www.last.fm/tag/thrash%20metal</url>
                         </tag>
                         </toptags>
                         ';
         $as = new Zend_Service_Audioscrobbler(TRUE, $test_response);
         $as->set('artist', 'Metallica');
         $response = $as->artistGetTopTags();
         $tag = $response->tag[0];
         $this->assertEquals((string) $response['artist'], 'Metallica');
         $this->assertEquals((string) $tag->name, 'metal');
         $this->assertEquals((int) $tag->count, 100);
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }