Answer the question
In order to leave comments, you need to log in
How to write tests for ReactPHP?
I'm trying to make tests for a server written in ReactPHP
Here is the code of the method that raises the server
public function createServer($uri = '127.0.0.1:5555'): LoopInterface
{
$loop = Factory::create();
$server = new Server($uri, $loop);
$connectionPool = new ConnectionPool();
$server->on('connection', function (ConnectionInterface $connection) use (&$connectionPool) {
$connectionPool->add($connection);
});
$loop->run();
return $loop;
}
public function testConnection(): void
{
$this->serverLoop = $this->createServer();
}
PHPUnit 7.2.6 by Sebastian Bergmann and contributors.
Runtime: PHP 7.2.3 with Xdebug 2.6.0
Configuration: /Users/PhpstormProjects/ReactPHPChat/phpunit.xml
E
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question