public function testUserGetTopTags() { try { $testing_response = "HTTP/1.1 200 OK\r\n" . "Content-type: text/xml\r\n" . "\r\n" . '<?xml version="1.0" encoding="UTF-8"?> <toptags user="******"> <tag> <name>rock</name> <count>9</count> <url>http://www.last.fm/tag/rock</url> </tag> <tag> <name>metal</name> <count>8</count> <url>http://www.last.fm/tag/metal</url> </tag> <tag> <name>mellow</name> <count>5</count> <url>http://www.last.fm/tag/mellow</url> </tag> </toptags>'; $as = new Zend_Service_Audioscrobbler(true, $testing_response); $as->set('user', 'RJ'); $response = $as->userGetTopTags(); $tag = $response->tag[1]; $this->assertEquals((string) $response['user'], 'RJ'); $this->assertNotNull($tag); $this->assertEquals((string) $tag->name, 'metal'); $this->assertEquals((int) $tag->count, 8); } catch (Exception $e) { $this->fail("Exception: [{$e}] thrown by test"); } }
public function testUserGetTopTags() { try { $as = new Zend_Service_Audioscrobbler(); $as->set('user', 'RJ'); $response = $as->userGetTopTags(); $this->assertEquals($response['user'], 'RJ'); $this->assertNotNull($response->tag); } catch (Exception $e) { $this->fail("Exception: [{$e->getMessage}()] thrown by test"); } }