1
0
mirror of https://github.com/danog/loop.git synced 2024-11-30 04:19:04 +01:00
loop/test/Fixtures.php

36 lines
739 B
PHP
Raw Normal View History

2022-12-24 14:36:39 +01:00
<?php declare(strict_types=1);
2020-07-21 19:53:57 +02:00
/**
* 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;
2023-01-24 12:23:10 +01:00
use PHPUnit\Framework\TestCase;
use Revolt\EventLoop;
2020-07-21 19:53:57 +02:00
/**
* Fixtures.
*/
2023-01-24 12:23:10 +01:00
abstract class Fixtures extends TestCase
2020-07-21 19:53:57 +02:00
{
2022-12-24 18:30:29 +01:00
const LOOP_NAME = 'TTTT';
2023-01-24 12:23:10 +01:00
protected static function waitTick(): void
2020-07-21 19:53:57 +02:00
{
2023-01-24 12:23:10 +01:00
$f = new \Amp\DeferredFuture;
\Revolt\EventLoop::defer(fn () => $f->complete());
$f->getFuture()->await();
2020-07-21 19:53:57 +02:00
}
2023-01-24 12:23:10 +01:00
protected function setUp(): void
2020-07-21 19:53:57 +02:00
{
2023-01-24 12:23:10 +01:00
EventLoop::run();
2020-07-21 19:53:57 +02:00
}
2023-01-24 12:23:10 +01:00
protected function tearDown(): void
2020-07-21 19:53:57 +02:00
{
2023-01-24 12:23:10 +01:00
EventLoop::run();
2020-07-21 19:53:57 +02:00
}
}