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

22 lines
473 B
PHP
Raw Normal View History

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