helly           Sat May 20 19:01:22 2006 UTC

  Modified files:              
    /php-src/ext/spl/tests      iterator_041.phpt 
  Log:
  - Update test
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/tests/iterator_041.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/spl/tests/iterator_041.phpt
diff -u php-src/ext/spl/tests/iterator_041.phpt:1.1 
php-src/ext/spl/tests/iterator_041.phpt:1.2
--- php-src/ext/spl/tests/iterator_041.phpt:1.1 Sat May 20 13:23:00 2006
+++ php-src/ext/spl/tests/iterator_041.phpt     Sat May 20 19:01:22 2006
@@ -36,16 +36,16 @@
                return parent::valid();
        }
 
-       function key()
+       function current()
        {
                self::fail(4, __FUNCTION__);
-               return parent::key();
+               return parent::current();
        }
 
-       function current()
+       function key()
        {
                self::fail(5, __FUNCTION__);
-               return parent::current();
+               return parent::key();
        }
 
        function next()
@@ -59,15 +59,15 @@
                self::fail(7, __FUNCTION__);
        }
 
-       static function test()
+       static function test($func)
        {
+               echo "===$func===\n";
                self::$fail = 0;
                while(self::$fail < 10)
                {
-                       echo '===' . self::$fail . "===\n";
                        try
                        {
-                               var_dump(iterator_to_array(new 
MyArrayIterator()));
+                               var_dump($func(new MyArrayIterator()));
                                break;
                        }
                        catch (Exception $e)
@@ -76,73 +76,37 @@
                        }
                        self::$fail++;
                }
-
-               self::$fail = 0;
-               while(self::$fail < 10)
-               {
-                       echo '===' . self::$fail . "===\n";
-                       try
-                       {
-                               var_dump(iterator_count(new MyArrayIterator()));
-                               break;
-                       }
-                       catch (Exception $e)
-                       {
-                               var_dump($e->getMessage());
-                       }
-                       if (self::$fail == 3)
-                       {
-                               self::$fail = 6;
-                       }
-                       else
-                       {
-                               self::$fail++;
-                       }
-               }
        }
 }
 
-MyArrayIterator::test();
+MyArrayIterator::test('iterator_to_array');
+MyArrayIterator::test('iterator_count');
 
 ?>
 ===DONE===
 <?php exit(0); ?>
 --EXPECT--
-===0===
+===iterator_to_array===
 string(22) "State 0: __construct()"
-===1===
 string(22) "State 1: __construct()"
-===2===
 string(17) "State 2: rewind()"
-===3===
 string(16) "State 3: valid()"
-===4===
-string(14) "State 4: key()"
-===5===
-string(18) "State 5: current()"
-===6===
+string(18) "State 4: current()"
+string(14) "State 5: key()"
 string(15) "State 6: next()"
-===7===
 string(21) "State 7: __destruct()"
-===8===
 array(2) {
   [0]=>
   int(1)
   [1]=>
   int(2)
 }
-===0===
+===iterator_count===
 string(22) "State 0: __construct()"
-===1===
 string(22) "State 1: __construct()"
-===2===
 string(17) "State 2: rewind()"
-===3===
 string(16) "State 3: valid()"
-===4===
 string(15) "State 6: next()"
-===7===
 string(21) "State 7: __destruct()"
-===8===
 int(2)
 ===DONE===

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to