Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Adding Logic In Case Of Exit #4604
I have been working on getting my testing setup within a CI. I was looking at the output of one such run when I realized that the test did not appear to be finishing, but was not giving any errors. After digging into it, I learned that one of my Junior Developers created a new class following some of the legacy code in the system. They put includes inside a class file (rather than relying on the PSR-4 Autoloader). One of these includes was a script to check a user's login/session and redirecting them to the homepage if they weren't logged in. Because a call to exit without params is equivalent to exit(0), my CI system thought that the test completed succesfully when it didn't actual do so.
This change is an attempt to catch such instances in the future. I use a shutdown function defined specifically for the execute to throw an exception in case the shutdown occurs.
Please note that I've not studied the Codeception Codebase so there may be a better way to detect this situation.
Thanks for the contribution!
Could you update that class in order to keep the core classes decoupled from error listeners