xml =<< test.userUpdate blahblahblah salutation Felsenblöcke firstname Lépiné lastname Géranté company Zend Technologies, Inc. EOX; $this->request = new Zend_XmlRpc_Request_Http(); $this->request->loadXml($this->xml); $this->server = $_SERVER; foreach ($_SERVER as $key => $value) { if ('HTTP_' == substr($key, 0, 5)) { unset($_SERVER[$key]); } } $_SERVER['HTTP_USER_AGENT'] = 'Zend_XmlRpc_Client'; $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['HTTP_CONTENT_TYPE'] = 'text/xml'; $_SERVER['HTTP_CONTENT_LENGTH'] = strlen($this->xml) + 1; } /** * Teardown environment */ public function tearDown() { $_SERVER = $this->server; unset($this->request); } public function testGetRawRequest() { $this->assertEquals($this->xml, $this->request->getRawRequest()); } public function testGetHeaders() { $expected = array( 'User-Agent' => 'Zend_XmlRpc_Client', 'Host' => 'localhost', 'Content-Type' => 'text/xml', 'Content-Length' => 958 ); $this->assertEquals($expected, $this->request->getHeaders()); } public function testGetFullRequest() { $expected =<<xml; $this->assertEquals($expected, $this->request->getFullRequest()); } public function testCanPassInMethodAndParams() { try { $request = new Zend_XmlRpc_Request_Http('foo', array('bar', 'baz')); } catch (Exception $e) { $this->fail('Should be able to pass in methods and params to request'); } } public function testExtendingClassShouldBeAbleToReceiveMethodAndParams() { try { $request = new Zend_XmlRpc_Request_HttpTest_Extension('foo', array('bar', 'baz')); } catch (Exception $e) { $this->fail('Should be able to pass in methods and params to request'); } $this->assertEquals('foo', $request->method); $this->assertEquals(array('bar', 'baz'), $request->params); } } class Zend_XmlRpc_Request_HttpTest_Extension extends Zend_XmlRpc_Request_Http { public function __construct($method = null, $params = null) { $this->method = $method; $this->params = (array) $params; } } // Call Zend_XmlRpc_Request_HttpTest::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == "Zend_XmlRpc_Request_HttpTest::main") { Zend_XmlRpc_Request_HttpTest::main(); }