public function testGetTopFans() { try { $testing_response = $this->header . '<?xml version="1.0" encoding="UTF-8"?> <fans artist="Metallica" track="Enter Sandman"> <user username="******"> <url>http://www.last.fm/user/suhis/</url> <image>http://static.last.fm/depth/catalogue/noimage/nouser_140px.jpg</image> <weight>2816666</weight> </user> <user username="******"> <url>http://www.last.fm/user/M4lu5/</url> <image>http://static.last.fm/avatar/ea9c0ddf6b6cc236dfc4297e376e9901.jpg</image> <weight>2380500</weight> </user> <user username="******"> <url>http://www.last.fm/user/Ceniza666/</url> <image>http://static.last.fm/depth/catalogue/noimage/nouser_140px.jpg</image> <weight>1352000</weight> </user> </fans> '; $as = new Zend_Service_Audioscrobbler(TRUE, $testing_response); $as->set('artist', 'Metallica'); $as->set('track', 'Enter Sandman'); $response = $as->trackGetTopFans(); $this->assertEquals((string) $response['artist'], 'Metallica'); $this->assertEquals((string) $response['track'], 'Enter Sandman'); $this->assertNotNull(count($response->user)); } catch (Exception $e) { $this->fail("Exception: [" . $e->getMessage() . "] thrown by test"); } }
public function testGetTopFans() { try { $as = new Zend_Service_Audioscrobbler(); $as->set('artist', 'Metallica'); $as->set('track', 'Enter Sandman'); $response = $as->trackGetTopFans(); $this->assertEquals($response['artist'], 'Metallica'); $this->assertEquals($response['track'], 'Enter Sandman'); $this->assertNotNull($response->user); } catch (Exception $e) { $this->fail("Exception: [" . $e->getMessage() . "] thrown by test"); } }