Skip to content

Commit

Permalink
Add basic test for arrayaccess and countable
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Jan 20, 2016
1 parent b5c43f5 commit 679eacd
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/1ParsingBugsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ public function testNilvalue()
$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...
Expand All @@ -572,4 +572,31 @@ public function TestLocale()
$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));
}
}
}

0 comments on commit 679eacd

Please sign in to comment.