2nd attempt at fixing tests
[plcapi.git] / tests / 1ParsingBugsTest.php
index ce463f7..1e4b040 100644 (file)
@@ -615,10 +615,11 @@ and there they were.</value></member><member><name>postid</name><value>7414222</
         $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);
+            $this->assertContains($key, $out);
+            $expected = $out[$key];
             if (gettype($expected['value']) == 'array') {
                 $this->assertequals('array', gettype($val));
             } else {
@@ -628,12 +629,14 @@ and there they were.</value></member><member><name>postid</name><value>7414222</
 
         $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');
+        $out = array(array('key' => 0, 'value'  => 'object'), array('key' => 1, 'value'  => 'object'));
+        $i = 0;
         foreach($v2 as $key => $val)
         {
-            $expected = each($out);
+            $expected = $out[$i];
             $this->assertequals($expected['key'], $key);
             $this->assertequals($expected['value'], gettype($val));
+            $i++;
         }
     }
 }