diff --git a/tests/FunctionalTest.php b/tests/FunctionalTest.php index 0cab36b..121ae23 100644 --- a/tests/FunctionalTest.php +++ b/tests/FunctionalTest.php @@ -112,11 +112,7 @@ public function testWriteClientLogin(Client $client, \stdClass $message) $message = $this->awaitMessage($client); $this->assertEquals('ClientLoginAck', $message->MsgType); - try { - $message = $this->awaitMessage($client); - } catch (\React\Promise\Timer\TimeoutException $e) { - $this->markTestIncomplete('Unhandled race condition, please retry'); - } + $message = $this->awaitMessage($client); $this->assertEquals('SessionInit', $message->MsgType); return $message; @@ -290,11 +286,15 @@ public function testCreateClientWithInvalidAuthUrlRejects() private function awaitMessage(Client $client) { - return Block\await(new Promise(function ($resolve, $reject) use ($client) { - $client->once('data', $resolve); + try { + return Block\await(new Promise(function ($resolve, $reject) use ($client) { + $client->once('data', $resolve); - $client->once('error', $reject); - $client->once('close', $reject); - }), Loop::get(), 10.0); + $client->once('error', $reject); + $client->once('close', $reject); + }), Loop::get(), 10.0); + } catch (\React\Promise\Timer\TimeoutException $e) { + $this->markTestIncomplete('Unhandled race condition, please retry'); + } } }