2020-08-23 16:18:28 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Amp\Test\Pipeline;
|
|
|
|
|
|
|
|
use Amp\PHPUnit\AsyncTestCase;
|
|
|
|
use Amp\Pipeline;
|
|
|
|
|
|
|
|
class ToArrayTest extends AsyncTestCase
|
|
|
|
{
|
2020-09-28 05:19:52 +02:00
|
|
|
public function testNonEmpty(): void
|
2020-08-23 16:18:28 +02:00
|
|
|
{
|
|
|
|
$pipeline = Pipeline\fromIterable(["abc", "foo", "bar"], 5);
|
2020-09-28 05:19:52 +02:00
|
|
|
$this->assertSame(["abc", "foo", "bar"], Pipeline\toArray($pipeline));
|
2020-08-23 16:18:28 +02:00
|
|
|
}
|
|
|
|
|
2020-09-28 05:19:52 +02:00
|
|
|
public function testEmpty(): void
|
2020-08-23 16:18:28 +02:00
|
|
|
{
|
|
|
|
$pipeline = Pipeline\fromIterable([], 5);
|
2020-09-28 05:19:52 +02:00
|
|
|
$this->assertSame([], Pipeline\toArray($pipeline));
|
2020-08-23 16:18:28 +02:00
|
|
|
}
|
|
|
|
}
|