-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Logic In Case Of Exit #4604
Conversation
After reviewing the code a bit more, I moved the logic into SuiteManager::run instead of Run::execute. It made more sense and fixed the issues with testing. |
Thanks for the contribution! Could you update that class in order to keep the core classes decoupled from error listeners |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've applied the updates. I did have to update another one of the tests that was creating an instance of the ErrorHandler and causing a Did Not Finish Error. |
Looks ok to me! |
Thanks! |
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.