X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2F1ParsingBugsTest.php;h=f32bd2e5e9d32379ae31ed5c2fffb5f745ecf323;hb=refs%2Ftags%2F4.0.0;hp=8ed214bdaf77ff99a47efc8cd2a71c113dd9bf30;hpb=58c58d4953465ea14af366ddc2afc8d901715461;p=plcapi.git
diff --git a/tests/1ParsingBugsTest.php b/tests/1ParsingBugsTest.php
index 8ed214b..f32bd2e 100644
--- a/tests/1ParsingBugsTest.php
+++ b/tests/1ParsingBugsTest.php
@@ -5,6 +5,8 @@
include_once __DIR__ . '/../lib/xmlrpc.inc';
include_once __DIR__ . '/../lib/xmlrpcs.inc';
+include_once __DIR__ . '/parse_args.php';
+
/**
* Tests involving parsing of xml and handling of xmlrpc values
*/
@@ -552,7 +554,7 @@ and there they were.postid7414222
$this->assertequals(2, $r->faultCode());
}
- public function TestLocale()
+ public function testLocale()
{
$locale = setlocale(LC_NUMERIC, 0);
/// @todo on php 5.3/win setting locale to german does not seem to set decimal separator to comma...
@@ -570,4 +572,31 @@ and there they were.postid7414222
$this->markTestSkipped('did not find a locale which sets decimal separator to comma');
}
}
+
+ 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)
+ {
+ $expected = each($out);
+ $this->assertequals($expected['key'], $key);
+ if (gettype($expected['value']) == 'array') {
+ $this->assertequals('array', gettype($val));
+ } else {
+ $this->assertequals($expected['value'], $val);
+ }
+ }
+
+ $v2 = new \PhpXmlRpc\Value(array(new \PhpXmlRpc\Value('one'), new \PhpXmlRpc\Value('two')), 'array');
+ $this->assertequals(2, count($v2));
+ $out = array(0 => 'object', 1 => 'object');
+ foreach($v2 as $key => $val)
+ {
+ $expected = each($out);
+ $this->assertequals($expected['key'], $key);
+ $this->assertequals($expected['value'], gettype($val));
+ }
+ }
}