Closed prolic closed 3 years ago
A combination of TestCase::setup()
and TestCase::tearDown()
can probably solve your issues without having to modify every test.
I tried that, but tearDown()
never gets called, because the test hangs in the test-method itself, because the loop won't stop running.
Well, if there is nothing that can be done about it, I think I need to go and change a couple hundred of tests. Thanks anyway! You helped me again.
Hmm… yes, I didn't think about tearDown()
not being reached.
An afterResolve()
method could be added that is executed after the returned promise is resolved but before the loop exits.
I guess the proper solution is to unreference the connection as long as it's idle, only doing heartbeats.
Should I reference back again when a new operation is executed and unreference as soon as the operation is done?
On Wed, Feb 19, 2020, 16:55 Niklas Keller notifications@github.com wrote:
I guess the proper solution is to unreference the connection as long as it's idle, only doing heartbeats.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amphp/phpunit-util/issues/12?email_source=notifications&email_token=AADAJPE5MLVLEGT4RXPETWLRDWFCLA5CNFSM4KX5R22KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMJIW7I#issuecomment-588417917, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADAJPBRMEMQKGWZQ4S347LRDWFCLANCNFSM4KX5R22A .
Yup.
Thanks, I'll give a try.
I have a TCP connection running in the event loop. This TCP connection has always something to do, like handling heart beats. I need to explicitly close the connection, otherwise the loop will run forever and never stop.
I used
wait(call(...))
before and there wasn't this problem. Using phpunit-util, I need to close the connection manually and add that line of code more than 400 test cases. Is there a way around this that can be incorporated into this lib?