本文整理匯總了PHP中Zend_XmlRpc_Request::addParam方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_XmlRpc_Request::addParam方法的具體用法?PHP Zend_XmlRpc_Request::addParam怎麽用?PHP Zend_XmlRpc_Request::addParam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_XmlRpc_Request
的用法示例。
在下文中一共展示了Zend_XmlRpc_Request::addParam方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testAddParam
/**
* addParam()/getParams() test
*/
public function testAddParam()
{
$this->_request->addParam('string1');
$params = $this->_request->getParams();
$this->assertEquals(1, count($params));
$this->assertEquals('string1', $params[0]);
$this->_request->addParam('string2');
$params = $this->_request->getParams();
$this->assertEquals(2, count($params));
$this->assertEquals('string1', $params[0]);
$this->assertEquals('string2', $params[1]);
}
示例2: testAddDateParamGeneratesCorrectXml
public function testAddDateParamGeneratesCorrectXml()
{
$time = time();
$this->_request->addParam($time, Zend_XmlRpc_Value::XMLRPC_TYPE_DATETIME);
$this->_request->setMethod('foo.bar');
$xml = $this->_request->saveXML();
$sxl = new SimpleXMLElement($xml);
$param = $sxl->params->param->value;
$type = 'dateTime.iso8601';
$this->assertTrue(isset($param->{$type}), var_export($param, 1));
$this->assertEquals($time, strtotime((string) $param->{$type}));
}
示例3: testHandleClassStaticMethod
public function testHandleClassStaticMethod()
{
$this->_server->setClass('Zend_XmlRpc_Server_testClass');
$request = new Zend_XmlRpc_Request();
$request->setMethod('test2');
$request->addParam(array('value1', 'value2'));
$response = $this->_server->handle($request);
$this->assertFalse($response instanceof Zend_XmlRpc_Fault);
$this->assertEquals('value1; value2', $response->getReturnValue());
}
示例4: testMulticall
/**
* multicall() test
*
* Call as method call
*
* Expects:
* - methods:
*
* Returns: array
*/
public function testMulticall()
{
$struct = array(array('methodName' => 'system.listMethods', 'params' => array()), array('methodName' => 'system.methodHelp', 'params' => array('system.multicall')));
$request = new Zend_XmlRpc_Request();
$request->setMethod('system.multicall');
$request->addParam($struct);
$response = $this->_server->handle($request);
$this->assertTrue($response instanceof Zend_XmlRpc_Response, $response->__toString());
$returns = $response->getReturnValue();
$this->assertTrue(is_array($returns));
$this->assertEquals(2, count($returns));
$this->assertTrue(is_array($returns[0]), var_export($returns[0], 1));
$this->assertTrue(is_string($returns[1]), var_export($returns[1], 1));
}