forked from sebastianbergmann/phpunit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unpack nested IteratorAggregate objects for Count
This allows generators (sebastianbergmann#2149) and internal Traversables (sebastianbergmann#2642) to be properly detected before attempting to restore the Iterator's position after counting (sebastianbergmann#1125).
- Loading branch information
Showing
3 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
/* This class is used for testing a chain of IteratorAggregate objects, since | ||
* PHP does allow IteratorAggregate::getIterator() to return an instance of the | ||
* same class. */ | ||
class TestIteratorAggregate2 implements IteratorAggregate | ||
{ | ||
private $traversable; | ||
|
||
public function __construct(\Traversable $traversable) | ||
{ | ||
$this->traversable = $traversable; | ||
} | ||
|
||
public function getIterator() | ||
{ | ||
return $this->traversable; | ||
} | ||
} |