From 48c759a7d9d2c0197b5f200e6c5395792c967c1b Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Tue, 22 Jun 2021 10:28:32 +0200 Subject: [PATCH] wip --- app/Client/Client.php | 12 +++++++++++- tests/Feature/Server/TunnelTest.php | 17 +++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/Client/Client.php b/app/Client/Client.php index 48225a2..b373356 100644 --- a/app/Client/Client.php +++ b/app/Client/Client.php @@ -31,6 +31,9 @@ class Client /** @var int */ protected $timeConnected = 0; + /** @var bool */ + protected $shouldExit = true; + public static $user = []; public static $subdomains = []; @@ -41,6 +44,11 @@ class Client $this->logger = $logger; } + public function shouldExit($shouldExit = true) + { + $this->shouldExit = $shouldExit; + } + public function share(string $sharedUrl, array $subdomains = [], $serverHost = null) { $sharedUrl = $this->prepareSharedUrl($sharedUrl); @@ -237,7 +245,9 @@ class Client $deferred->reject(); $this->loop->futureTick(function () { - exit(1); + if ($this->shouldExit) { + exit(1); + } }); } diff --git a/tests/Feature/Server/TunnelTest.php b/tests/Feature/Server/TunnelTest.php index 118957a..77304ed 100644 --- a/tests/Feature/Server/TunnelTest.php +++ b/tests/Feature/Server/TunnelTest.php @@ -155,19 +155,6 @@ class TunnelTest extends TestCase $this->assertInstanceOf(Connection::class, $connection); } - /** @test */ - public function it_rejects_tcp_sharing_if_disabled() - { - $this->createTestTcpServer(); - - $this->app['config']['expose.admin.allow_tcp_port_sharing'] = false; - - $this->expectException(\UnexpectedValueException::class); - - $client = $this->createClient(); - $this->await($client->connectToServerAndShareTcp(8085)); - } - /** @test */ public function it_rejects_tcp_sharing_if_forbidden() { @@ -707,7 +694,9 @@ class TunnelTest extends TestCase ->setPort(8080) ->createClient(); - return app(Client::class); + $client = app(Client::class); + $client->shouldExit(false); + return $client; } protected function createUser(array $data)