public function testUserGetTopAlbums() { try { $as = new Zend_Service_Audioscrobbler(); $as->set('user', 'Frith'); $response = $as->userGetTopAlbums(); $this->assertEquals($response['user'], 'Frith'); $this->assertNotNull($response->album); } catch (Exception $e) { $this->fail("Exception: [" . $e->getMessage() . "] thrown by test"); } }
public function testUserGetTopAlbums() { 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"?> <topalbums user="******"> <album> <artist mbid="d8915e13-d67a-4aa0-9c0b-1f126af951af">Hot Chip</artist> <name>The Warning</name> <mbid></mbid> <playcount>227</playcount> <rank>1</rank> <url>http://www.last.fm/music/Hot+Chip/The+Warning</url> <image> <large>http://images.amazon.com/images/P/B000FBFSVU.01._SCMZZZZZZZ_.jpg</large> <medium>http://images.amazon.com/images/P/B000FBFSVU.01._SCMZZZZZZZ_.jpg</medium> <small>http://images.amazon.com/images/P/B000FBFSVU.01._SCMZZZZZZZ_.jpg</small> </image> </album> </topalbums>'; $as = new Zend_Service_Audioscrobbler(true, $testing_response); $as->set('user', 'Frith'); $response = $as->userGetTopAlbums(); $album = $response->album[0]; $this->assertEquals((string) $response['user'], 'Frith'); $this->assertNotNull($album); $this->assertEquals((string) $album->name, 'The Warning'); } catch (Exception $e) { $this->fail("Exception: [" . $e . "] thrown by test"); } }