diff options
author | Nikita Popov <nikic@php.net> | 2012-08-20 12:53:18 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2012-08-20 12:53:18 +0200 |
commit | 05f10480c556ebe52bbef52cb2da5a0aca8ee070 (patch) | |
tree | 0c05673c6345bfc7cbdf09c6795485669d0bf74d /Zend/tests/generators | |
parent | 7195a5b3768e519b8f50d131a8c7041a0b57959e (diff) | |
download | php-git-05f10480c556ebe52bbef52cb2da5a0aca8ee070.tar.gz |
Drop Generator::close() method
Diffstat (limited to 'Zend/tests/generators')
-rw-r--r-- | Zend/tests/generators/clone_with_foreach.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/generators/clone_with_stack.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/generators/clone_with_symbol_table.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/generators/clone_with_this.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/generators/close_inside_generator.phpt | 22 | ||||
-rw-r--r-- | Zend/tests/generators/generator_close.phpt | 32 | ||||
-rw-r--r-- | Zend/tests/generators/yield_during_method_call.phpt | 4 |
7 files changed, 6 insertions, 60 deletions
diff --git a/Zend/tests/generators/clone_with_foreach.phpt b/Zend/tests/generators/clone_with_foreach.phpt index b887338036..b05ed07312 100644 --- a/Zend/tests/generators/clone_with_foreach.phpt +++ b/Zend/tests/generators/clone_with_foreach.phpt @@ -20,7 +20,7 @@ $g2->next(); var_dump($g1->current()); var_dump($g2->current()); -$g1->close(); +unset($g1); $g2->next(); var_dump($g2->current()); diff --git a/Zend/tests/generators/clone_with_stack.phpt b/Zend/tests/generators/clone_with_stack.phpt index 673c0e5d1e..5a8e6d842c 100644 --- a/Zend/tests/generators/clone_with_stack.phpt +++ b/Zend/tests/generators/clone_with_stack.phpt @@ -10,7 +10,7 @@ function gen() { $g1 = gen(); $g1->rewind(); $g2 = clone $g1; -$g1->close(); +unset($g1); $g2->send(10); ?> diff --git a/Zend/tests/generators/clone_with_symbol_table.phpt b/Zend/tests/generators/clone_with_symbol_table.phpt index 0d1bd4ec3c..e1fefebd8f 100644 --- a/Zend/tests/generators/clone_with_symbol_table.phpt +++ b/Zend/tests/generators/clone_with_symbol_table.phpt @@ -19,7 +19,7 @@ function gen() { $g1 = gen(); $g1->rewind(); $g2 = clone $g1; -$g1->close(); +unset($g1); $g2->next(); ?> diff --git a/Zend/tests/generators/clone_with_this.phpt b/Zend/tests/generators/clone_with_this.phpt index 66efd02987..b242d851eb 100644 --- a/Zend/tests/generators/clone_with_this.phpt +++ b/Zend/tests/generators/clone_with_this.phpt @@ -16,7 +16,7 @@ class Test { $g1 = (new Test)->gen(); $g1->rewind(); // goto yield $g2 = clone $g1; -$g1->close(); +unset($g1); $g2->next(); ?> diff --git a/Zend/tests/generators/close_inside_generator.phpt b/Zend/tests/generators/close_inside_generator.phpt deleted file mode 100644 index 1df64bf6b1..0000000000 --- a/Zend/tests/generators/close_inside_generator.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Calling close() during the exectution of the generator ---FILE-- -<?php - -function gen() { - /* Pass the generator object itself in */ - $gen = yield; - - /* Close generator while it is currently running */ - $gen->close(); - - echo "Still running"; -} - -$gen = gen(); -$gen->send($gen); - -?> ---EXPECTF-- -Warning: A generator cannot be closed while it is running in %s on line %d -Still running diff --git a/Zend/tests/generators/generator_close.phpt b/Zend/tests/generators/generator_close.phpt deleted file mode 100644 index 3dec285409..0000000000 --- a/Zend/tests/generators/generator_close.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Generator can be closed by calling ->close() ---FILE-- -<?php - -function allNumbers() { - for ($i = 0; true; ++$i) { - yield $i; - } -} - -$numbers = allNumbers(); - -foreach ($numbers as $n) { - var_dump($n); - if ($n == 9) { - $numbers->close(); - } -} - -?> ---EXPECT-- -int(0) -int(1) -int(2) -int(3) -int(4) -int(5) -int(6) -int(7) -int(8) -int(9) diff --git a/Zend/tests/generators/yield_during_method_call.phpt b/Zend/tests/generators/yield_during_method_call.phpt index e8859ac0c2..5fbe84fff5 100644 --- a/Zend/tests/generators/yield_during_method_call.phpt +++ b/Zend/tests/generators/yield_during_method_call.phpt @@ -20,13 +20,13 @@ $gen->send('foo'); // test resource cleanup $gen = gen(); $gen->rewind(); -$gen->close(); +unset($gen); // test cloning $g1 = gen(); $g1->rewind(); $g2 = clone $g1; -$g1->close(); +unset($g1); $g2->send('bar'); ?> |