mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-15 06:25:56 +00:00
wip
This commit is contained in:
36
tests/Feature/Client/TestCase.php
Normal file
36
tests/Feature/Client/TestCase.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Client;
|
||||
|
||||
use React\EventLoop\Factory;
|
||||
use React\EventLoop\LoopInterface;
|
||||
use React\EventLoop\StreamSelectLoop;
|
||||
use React\Promise\PromiseInterface;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
use function Clue\React\Block\await;
|
||||
|
||||
abstract class TestCase extends \Tests\TestCase
|
||||
{
|
||||
const AWAIT_TIMEOUT = 1.0;
|
||||
|
||||
/** @var LoopInterface */
|
||||
protected $loop;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->app->bind(ConsoleOutputInterface::class, function() {
|
||||
return new ConsoleOutput();
|
||||
});
|
||||
|
||||
/** @var LoopInterface $loop */
|
||||
$this->loop = $this->app->make(LoopInterface::class);
|
||||
}
|
||||
|
||||
protected function await(PromiseInterface $promise, LoopInterface $loop = null, $timeout = null)
|
||||
{
|
||||
return await($promise, $loop ?? $this->loop, $timeout ?? static::AWAIT_TIMEOUT);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user