Skip to content

Commit

Permalink
Add a test for counting generators
Browse files Browse the repository at this point in the history
  • Loading branch information
duncan3dc committed Dec 12, 2015
1 parent 6055566 commit 993a234
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Zend/tests/generators/errors/count_error.phpt
@@ -0,0 +1,21 @@
--TEST--
Generators can't be counted
--FILE--
<?php

function gen() { yield; }

$gen = gen();

try {
count($gen);
} catch (Exception $e) {
echo $e;
}

?>
--EXPECTF--
Exception: Counting of 'Generator' is not allowed in %s:%d
Stack trace:
#0 %s(%d): count(Object(Generator))
#1 {main}

0 comments on commit 993a234

Please sign in to comment.