mirror of
https://github.com/danog/amp.git
synced 2024-12-03 18:07:57 +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)));
|
|
}
|
|
}
|