public function testGetFans() { try { $test_response = $this->header . '<?xml version="1.0" encoding="UTF-8"?> <fans artist="Metallica"> <user username="******"> <url>http://www.last.fm/user/Liquid_Fire/</url> <image>http://static.last.fm/avatar/d8d9af8246e537078a57d5dc826cb34a.gif</image> <weight>617010250</weight> </user> <user username="******"> <url>http://www.last.fm/user/CeciltheDark/</url> <image>http://static.last.fm/avatar/30f0417393b696ac2ea06213bc5777d9.png</image> <weight>382812500</weight> </user> </fans> '; $as = new Zend_Service_Audioscrobbler(TRUE, $test_response); $as->set('artist', 'Metallica'); $response = $as->artistGetTopFans(); $user = $response->user[0]; $this->assertEquals((string) $response['artist'], 'Metallica'); $this->assertEquals((string) $user->url, 'http://www.last.fm/user/Liquid_Fire/'); return; } catch (Exception $e) { $this->fail("Exception: [" . $e->getMessage() . "] thrown by test"); } }
public function testGetFans() { try { $as = new Zend_Service_Audioscrobbler(); $as->set('artist', 'Metallica'); $response = $as->artistGetTopFans(); $this->assertNotNull($response->fans); $this->assertEquals($response['artist'], 'Metallica'); $this->assertNotNull($response->user); return; } catch (Exception $e) { $this->fail("Exception: [" . $e->getMessage() . "] thrown by test"); } }