2020-08-23 16:18:28 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Amp\Test\Pipeline;
|
|
|
|
|
|
|
|
use Amp\PHPUnit\AsyncTestCase;
|
|
|
|
use Amp\Pipeline;
|
2020-09-28 05:19:52 +02:00
|
|
|
use function Amp\await;
|
2020-08-23 16:18:28 +02:00
|
|
|
|
|
|
|
class DiscardTest extends AsyncTestCase
|
|
|
|
{
|
2020-09-28 05:19:52 +02:00
|
|
|
public function testEmpty(): void
|
2020-08-23 16:18:28 +02:00
|
|
|
{
|
2021-03-26 22:34:32 +01:00
|
|
|
self::assertSame(0, await(Pipeline\discard(Pipeline\fromIterable([]))));
|
2020-08-23 16:18:28 +02:00
|
|
|
}
|
|
|
|
|
2020-09-28 05:19:52 +02:00
|
|
|
public function testCount(): void
|
2020-08-23 16:18:28 +02:00
|
|
|
{
|
2021-03-26 22:34:32 +01:00
|
|
|
self::assertSame(3, await(Pipeline\discard(Pipeline\fromIterable(['a', 1, false], 1))));
|
2020-08-23 16:18:28 +02:00
|
|
|
}
|
|
|
|
}
|