1
0
mirror of https://github.com/danog/loop.git synced 2024-11-26 20:04:44 +01:00
loop/test/Fixtures.php
2023-01-24 12:23:10 +01:00

36 lines
739 B
PHP

<?php declare(strict_types=1);
/**
* Loop test.
*
* @author Daniil Gentili <daniil@daniil.it>
* @copyright 2016-2020 Daniil Gentili <daniil@daniil.it>
* @license https://opensource.org/licenses/MIT MIT
*/
namespace danog\Loop\Test;
use PHPUnit\Framework\TestCase;
use Revolt\EventLoop;
/**
* Fixtures.
*/
abstract class Fixtures extends TestCase
{
const LOOP_NAME = 'TTTT';
protected static function waitTick(): void
{
$f = new \Amp\DeferredFuture;
\Revolt\EventLoop::defer(fn () => $f->complete());
$f->getFuture()->await();
}
protected function setUp(): void
{
EventLoop::run();
}
protected function tearDown(): void
{
EventLoop::run();
}
}