本文整理汇总了PHP中Zend_XmlRpc_Value::setGenerator方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_XmlRpc_Value::setGenerator方法的具体用法?PHP Zend_XmlRpc_Value::setGenerator怎么用?PHP Zend_XmlRpc_Value::setGenerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_XmlRpc_Value
的用法示例。
在下文中一共展示了Zend_XmlRpc_Value::setGenerator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMarschalBigIntegerFromApacheXmlRpc
/**
* @group ZF-6445
* @dataProvider Zend_XmlRpc_TestProvider::provideGenerators
*/
public function testMarschalBigIntegerFromApacheXmlRpc(Zend_XmlRpc_Generator_GeneratorAbstract $generator)
{
Zend_XmlRpc_Value::setGenerator($generator);
$bigIntegerValue = (string) (PHP_INT_MAX + 42);
$bigInteger = new Zend_XmlRpc_Value_BigInteger($bigIntegerValue);
$bigIntegerXml = '<value><ex:i8 xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">' . $bigIntegerValue . '</ex:i8></value>';
$value = Zend_XmlRpc_Value::getXmlRpcValue($bigIntegerXml, Zend_XmlRpc_Value::XML_STRING);
$this->assertSame($bigIntegerValue, $value->getValue());
$this->assertEquals(Zend_XmlRpc_Value::XMLRPC_TYPE_I8, $value->getType());
$this->assertEquals($this->wrapXml($bigIntegerXml), $value->saveXml());
}
示例2: testMarshalBase64FromXmlRpc
/**
* @dataProvider Zend_XmlRpc_TestProvider::provideGenerators
*/
public function testMarshalBase64FromXmlRpc(Zend_XmlRpc_Generator_GeneratorAbstract $generator)
{
Zend_XmlRpc_Value::setGenerator($generator);
$native = 'foo';
$xml = '<value><base64>' . base64_encode($native) . '</base64></value>';
$val = Zend_XmlRpc_Value::getXmlRpcValue($xml, Zend_XmlRpc_Value::XML_STRING);
$this->assertXmlRpcType('base64', $val);
$this->assertEquals('base64', $val->getType());
$this->assertSame($native, $val->getValue());
$this->assertEquals($this->wrapXml($xml), $val->saveXml());
}
示例3: set_include_path
<?php
/**
* Zend_XmlRpc_Generator_XmlWriter->saveXml()
* fix
* $this->_xmlWriter->flush(false)
* to
* $this->_xmlWriter->flush(true);
*/
// installed framework
set_include_path(realpath('../src/ZendFramework/library'));
// required classes
require_once 'Zend/XmlRpc/Generator/XmlWriter.php';
require_once 'Zend/XmlRpc/Value.php';
// be sure to use the leaky generator
$generator = new Zend_XmlRpc_Generator_XmlWriter();
Zend_XmlRpc_Value::setGenerator($generator);
// test a thousand times
for ($i = 1000; $i > 0; $i--) {
// make a thousand stars
$bug = str_pad('', 1000, '*');
// factorize value
$bug = Zend_XmlRpc_Value::getXmlRpcValue($bug, Zend_XmlRpc_Value::XMLRPC_TYPE_STRING);
// save value, this leaks!
$bug = $bug->saveXml();
// report sometimes
if ($i % 100 === 0) {
$mem = floor(memory_get_usage() / 1024);
echo "KB {$mem}\n";
}
// print once
if ($i === 1) {