Skip to content

Commit

Permalink
Test that unpack() indeed can process iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
sanmai committed Oct 19, 2018
1 parent a1217b8 commit b9ab454
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/UnpackTest.php
Expand Up @@ -20,6 +20,7 @@
namespace Tests\Pipeline;

use PHPUnit\Framework\TestCase;
use function Pipeline\fromArray;

/**
* @covers \Pipeline\Standard
Expand Down Expand Up @@ -63,4 +64,16 @@ public function testFlatMap()

$this->assertEquals((10 * 11) / 2, round($pipeline->reduce()));
}

/**
* @covers \Pipeline\Standard::unpack()
*/
public function testWithIterator()
{
$this->assertSame([1, 2, 3], fromArray([
new \ArrayIterator([1]),
fromArray([2]),
[3],
])->unpack()->toArray());
}
}

0 comments on commit b9ab454

Please sign in to comment.