mirror of
https://github.com/danog/amp.git
synced 2024-12-12 09:29:45 +01:00
23 lines
511 B
PHP
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)));
|
|
}
|
|
}
|