1
0
mirror of https://github.com/danog/amp.git synced 2024-12-12 09:29:45 +01:00
amp/test/Iterator/ToArrayTest.php
Aaron Piotrowski 96007f11aa
Add Streams
2020-09-24 12:53:27 -05:00

23 lines
511 B
PHP

<?php
namespace Amp\Test\Iterator;
use Amp\Iterator;
use Amp\Test\BaseTest;
use function Amp\Promise\wait;
class ToArrayTest extends BaseTest
{
public function testNonEmpty()
{
$iterator = Iterator\fromIterable(["abc", "foo", "bar"], 5);
$this->assertSame(["abc", "foo", "bar"], wait(Iterator\toArray($iterator)));
}
public function testEmpty()
{
$iterator = Iterator\fromIterable([], 5);
$this->assertSame([], wait(Iterator\toArray($iterator)));
}
}