/** * @param Request $request * @param string $class * @param string $method * @throws \fproject\amf\AmfException */ protected function _addServiceCall($request, $class = 'Zend_Amf_Auth_testclass', $method = 'hello') { $data[] = "12345"; $this->_server->setClass($class); $newBody = new MessageBody("{$class}.{$method}", "/1", $data); $request->addAmfBody($newBody); }
protected function _callService($method, $class = 'Zend_Amf_Resource_testclass') { $request = new Request(); $request->setObjectEncoding(0x3); $this->_server->setClass($class); $newBody = new MessageBody("{$class}.{$method}", "/1", array("test")); $request->addAmfBody($newBody); $this->_server->handle($request); $response = $this->_server->getResponse(); return $response; }
public function testCtorExcection() { $this->_server->setClass('Zend_Amf_testException'); $this->_server->setProduction(false); $message = new RemotingMessage(); $message->operation = 'hello'; $message->source = 'Zend_Amf_testException'; $message->body = array("123"); // create a mock message body to place th remoting message inside $newBody = new MessageBody(null, "/1", $message); $request = new Request(); // at the requested service to a request $request->addAmfBody($newBody); $request->setObjectEncoding(0x3); // let the server handle mock request $this->_server->handle($request); $response = $this->_server->getResponse()->getAMFBodies(); $this->assertTrue($response[0]->getData() instanceof ErrorMessage); $this->assertContains("Oops, exception!", $response[0]->getData()->faultString); }