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 Oct 2, 2016
1 parent 73f6dfb commit 2741d8f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Zend/tests/generators/errors/count_error.phpt
@@ -0,0 +1,18 @@
--TEST--
Generators can't be counted
--FILE--
<?php

function gen() { yield; }

$gen = gen();

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

?>
--EXPECTF--
Warning: count(): Cannot count objects that do not implement Countable in %s on line %d

0 comments on commit 2741d8f

Please sign in to comment.