1
0
mirror of https://github.com/danog/amp.git synced 2024-12-04 18:38:17 +01:00
amp/test/Stream/ToArrayTest.php

23 lines
499 B
PHP
Raw Normal View History

2020-05-13 17:15:21 +02:00
<?php
namespace Amp\Test\Stream;
use Amp\Stream;
use Amp\Test\BaseTest;
use function Amp\Promise\wait;
class ToArrayTest extends BaseTest
{
public function testNonEmpty()
{
$iterator = Stream\fromIterable(["abc", "foo", "bar"], 5);
$this->assertSame(["abc", "foo", "bar"], wait(Stream\toArray($iterator)));
}
public function testEmpty()
{
$iterator = Stream\fromIterable([], 5);
$this->assertSame([], wait(Stream\toArray($iterator)));
}
}