public function testUserRecentBannedTracks() { try { $testing_response = "HTTP/1.1 200 OK\r\nContent-type: text/xml\r\n\r\n" . '<?xml version="1.0" encoding="UTF-8"?> <recentbannedtracks user="******"> <track> <artist mbid="27613b78-1b9d-4ec3-9db5-fa0743465fdd">Herbie Hancock</artist> <name>Rockit</name> <mbid></mbid> <url>http://www.last.fm/music/Herbie+Hancock/_/Rockit</url> <date uts="1171126557">10 Feb 2007, 16:55</date> </track> <track> <artist mbid="7e54d133-2525-4bc0-ae94-65584145a386">Plaid</artist> <name>Plaid Rmx</name> <mbid></mbid> <url>http://www.last.fm/music/Plaid/_/Plaid+Rmx</url> <date uts="1161129235">17 Oct 2006, 23:53</date> </track> </recentbannedtracks>'; $as = new Zend_Service_Audioscrobbler(true, $testing_response); $as->set('user', 'RJ'); $response = $as->userGetRecentBannedTracks(); $track = $response->track[0]; $this->assertEquals((string) $response['user'], 'RJ'); $this->assertEquals(count($response->track), 2); $this->assertEquals((string) $track->artist, 'Herbie Hancock'); $this->assertEquals((string) $track->name, 'Rockit'); } catch (Exception $e) { $this->fail("Exception: [" . $e->getMessage() . "] thrown by test"); } }
public function testUserRecentBannedTracks() { try { $as = new Zend_Service_Audioscrobbler(); $as->set('user', 'RJ'); $response = $as->userGetRecentBannedTracks(); $this->assertEquals($response['user'], 'RJ'); $this->assertNotNull($response->recentbannedtracks); $this->assertNotNull($response->track); } catch (Exception $e) { $this->fail("Exception: [" . $e->getMessage() . "] thrown by test"); } }