Esempio n. 1
0
    public function testUserGetFriends()
    {
        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"?>
                            <friends user="******">
                            <user username="******">
                                <url>http://www.last.fm/user/julians/</url>
                                <image>http://static.last.fm/avatar/9ca899b8f20b7173d47983cc0533be8c.gif</image>
                                <connections>
                                    </connections>

                                </user>
                            <user username="******">
                                <url>http://www.last.fm/user/Korean_Cowboy/</url>
                                <image>http://static.last.fm/avatar/091614ec2288764362c94f047d207336.jpg</image>
                                <connections>
                                    </connections>

                                </user>
                            </friends>';
            $as = new Zend_Service_Audioscrobbler(true, $testing_response);
            $as->set('user', 'RJ');
            $response = $as->userGetFriends();
            $this->assertEquals((string) $response['user'], 'RJ');
            $this->assertEquals(count($response->user), 2);
        } catch (Exception $e) {
            $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
        }
    }
Esempio n. 2
0
 public function testUserGetFriends()
 {
     try {
         $as = new Zend_Service_Audioscrobbler();
         $as->set('user', 'RJ');
         $response = $as->userGetFriends();
         $this->assertEquals($response['user'], 'RJ');
         $this->assertNotNull($response->friends);
         $this->assertNotNull($response->user);
     } catch (Exception $e) {
         $this->fail("Exception: [" . $e->getMessage() . "] thrown by test");
     }
 }