From fd82904a9e63a74b7880fef7e27f1e8b2c67fd70 Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Tue, 18 Aug 2020 23:09:12 +0300 Subject: [PATCH] Updated test for the start command --- src/Console/StartWebSocketServer.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Console/StartWebSocketServer.php b/src/Console/StartWebSocketServer.php index e6d047f..51e3d02 100644 --- a/src/Console/StartWebSocketServer.php +++ b/src/Console/StartWebSocketServer.php @@ -240,10 +240,16 @@ class StartWebSocketServer extends Command $this->buildServer(); - if (! $this->option('test')) { - /* 🛰 Start the server 🛰 */ - $this->server->run(); + // For testing, just boot up the server, run it + // but exit after the next tick. + if ($this->option('test')) { + $this->loop->futureTick(function () { + $this->loop->stop(); + }); } + + /* 🛰 Start the server 🛰 */ + $this->server->run(); } /**