2017-12-14 06:06:38 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Amp\Parallel\Test\Worker;
|
|
|
|
|
|
|
|
use Amp\Parallel\Worker\Internal\TaskSuccess;
|
2019-08-27 19:17:41 +02:00
|
|
|
use Amp\PHPUnit\AsyncTestCase;
|
2017-12-14 06:06:38 +01:00
|
|
|
use Amp\Promise;
|
|
|
|
|
2019-08-27 19:17:41 +02:00
|
|
|
class TaskSuccessTest extends AsyncTestCase
|
2018-10-07 16:50:45 +02:00
|
|
|
{
|
|
|
|
public function testGetId()
|
|
|
|
{
|
2017-12-14 06:06:38 +01:00
|
|
|
$id = 'a';
|
|
|
|
$result = new TaskSuccess($id, 1);
|
|
|
|
$this->assertSame($id, $result->getId());
|
|
|
|
}
|
|
|
|
|
2018-10-07 16:50:45 +02:00
|
|
|
public function testPromise()
|
|
|
|
{
|
2017-12-14 06:06:38 +01:00
|
|
|
$value = 1;
|
|
|
|
$result = new TaskSuccess('a', $value);
|
|
|
|
$this->assertSame($value, Promise\wait($result->promise()));
|
|
|
|
}
|
|
|
|
}
|