public function testGetProfile() { $g = $this->_getMockedGravatar('{"test":"example"}'); $this->assertEquals( array('test' => 'example'), $g->getProfile('test@example.org') ); } private function _getMockedGravatar($response_string) { $response = $this->getMock('Horde_Http_Response', array('getBody')); $response->expects($this->once()) ->method('getBody') ->will($this->returnValue($response_string)); $mock = $this->getMock('Horde_Http_Client', array('get')); $mock->expects($this->once()) ->method('get') ->will($this->returnValue($response)); return new Horde_Service_Gravatar( Horde_Service_Gravatar::STANDARD, $mock ); }