1
0
mirror of https://github.com/danog/amp.git synced 2024-12-11 17:09:40 +01:00
amp/test/Iterator/ToArrayTest.php
2020-10-02 13:40:29 -05:00

22 lines
517 B
PHP

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