1
0
mirror of https://github.com/danog/amp.git synced 2024-12-04 10:28:01 +01:00
amp/test/IteratorToArrayTest.php

23 lines
513 B
PHP
Raw Normal View History

2018-10-05 21:06:27 +02:00
<?php
namespace Amp\Test;
use Amp\Iterator;
use Amp\PHPUnit\TestCase;
use function Amp\Promise\wait;
class IteratorToArrayTest extends TestCase
2018-10-05 21:06:27 +02:00
{
public function testNonEmpty()
2018-10-05 21:06:27 +02:00
{
$iterator = Iterator\fromIterable(["abc", "foo", "bar"], 5);
$this->assertSame(["abc", "foo", "bar"], wait(Iterator\toArray($iterator)));
2018-10-05 21:06:27 +02:00
}
public function testEmpty()
{
$iterator = Iterator\fromIterable([], 5);
$this->assertSame([], wait(Iterator\toArray($iterator)));
2018-10-05 21:06:27 +02:00
}
}