Simplify generator setup in tests

parent 52df7a11
...@@ -53,7 +53,7 @@ class CachingIteratorTest extends TestCase ...@@ -53,7 +53,7 @@ class CachingIteratorTest extends TestCase
public function testPartialIterationDoesNotExhaust() public function testPartialIterationDoesNotExhaust()
{ {
$traversable = $this->getTraversableThatThrows([1, 2, new Exception()]); $traversable = $this->getTraversable([1, 2, new Exception()]);
$iterator = new CachingIterator($traversable); $iterator = new CachingIterator($traversable);
$expectedKey = 0; $expectedKey = 0;
...@@ -110,13 +110,6 @@ class CachingIteratorTest extends TestCase ...@@ -110,13 +110,6 @@ class CachingIteratorTest extends TestCase
} }
private function getTraversable($items) private function getTraversable($items)
{
foreach ($items as $item) {
yield $item;
}
}
private function getTraversableThatThrows($items)
{ {
foreach ($items as $item) { foreach ($items as $item) {
if ($item instanceof Exception) { if ($item instanceof Exception) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment