2020-08-23 16:18:28 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Amp\Test\Pipeline;
|
|
|
|
|
|
|
|
use Amp\PHPUnit\AsyncTestCase;
|
|
|
|
use Amp\Pipeline;
|
|
|
|
|
|
|
|
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-04-04 20:10:23 +02:00
|
|
|
self::assertSame(0, Pipeline\discard(Pipeline\fromIterable([]))->join());
|
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-04-04 20:10:23 +02:00
|
|
|
self::assertSame(3, Pipeline\discard(Pipeline\fromIterable(['a', 1, false], 1))->join());
|
2020-08-23 16:18:28 +02:00
|
|
|
}
|
|
|
|
}
|