+
+ public function testArrayAccess()
+ {
+ $v1 = new xmlrpcval(array(new xmlrpcval('one'), new xmlrpcval('two')), 'array');
+ $this->assertequals(1, count($v1));
+ $out = array('me' => array(), 'mytype' => 2, '_php_class' => null);
+
+ foreach($v1 as $key => $val)
+ {
+ $this->assertArrayHasKey($key, $out);
+ $expected = $out[$key];
+ if (gettype($expected) == 'array') {
+ $this->assertequals('array', gettype($val));
+ } else {
+ $this->assertequals($expected, $val);
+ }
+ }
+
+ $v2 = new \PhpXmlRpc\Value(array(new \PhpXmlRpc\Value('one'), new \PhpXmlRpc\Value('two')), 'array');
+ $this->assertequals(2, count($v2));
+ $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object'));
+ $i = 0;
+ foreach($v2 as $key => $val)
+ {
+ $expected = $out[$i];
+ $this->assertequals($expected['key'], $key);
+ $this->assertequals($expected['value'], gettype($val));
+ $i++;
+ }
+ }
+
+ function testBigXML()
+ {
+ // nb: make sure that the serialized xml corresponding to this is > 10MB in size
+ $data = array();
+ for ($i = 0; $i < 500000; $i++ ) {
+ $data[] = 'hello world';
+ }
+
+ $encoder = new \PhpXmlRpc\Encoder();
+ $val = $encoder->encode($data);
+ $req = new \PhpXmlRpc\Request('test', array($val));
+ $xml = $req->serialize();
+ $parser = new \PhpXmlRpc\Helper\XMLParser();
+ $parser->parse($xml);
+
+ $this->assertequals(0, $parser->_xh['isf']);
+ }