public function testUserGetNeighbours() { 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"?> <neighbours user="******"> <user username="******"> <url>http://www.last.fm/user/count-bassy/</url> <image>http://static.last.fm/avatar/3da65e2f347f64c033c9eced171e7a21.gif</image> <match>100</match> </user> <user username="******"> <url>http://www.last.fm/user/arcymarcy/</url> <image>http://static.last.fm/avatar/eed7d6afea225f85cfcd6ee61eac19aa.jpg</image> <match>93.12</match> </user> </neighbours>'; $as = new Zend_Service_Audioscrobbler(true, $testing_response); $as->set('user', 'RJ'); $response = $as->userGetNeighbours(); $this->assertEquals((string) $response['user'], 'RJ'); $this->assertEquals(count($response->user), 2); $user = $response->user[1]; $this->assertEquals((string) $user['username'], 'arcymarcy'); } catch (Exception $e) { $this->fail("Exception: [" . $e->getMessage() . "] thrown by test"); } }
public function testUserGetNeighbours() { try { $as = new Zend_Service_Audioscrobbler(); $as->set('user', 'RJ'); $response = $as->userGetNeighbours(); $this->assertEquals($response['user'], 'RJ'); $this->assertNotNull($response->user); $this->assertNotNull($response->neighbours); } catch (Exception $e) { $this->fail("Exception: [" . $e->getMessage() . "] thrown by test"); } }