PHPUnit testing bootstrap improvements
What I Did
Don’t redirect when migrations are out of date for unit tests
Don’t use database sessions when running unit tests
PHPUnit_Framework_Exceptioninstead of redirecting so you can track why PHPUnit silently stopped executing
It's possible that someone might want to legitimately test that the redirect function was called. I'm not sure & haven't tested how this might work, but there may be a way to mock the redirect function or something. In any case, you wouldn't be cant test the redirect function in this way without something similar even before this patch.
Easiest way to test is against the AFES PHPUnit tests:
feature/unit_testing. Completely empty the
afes_unit_testing database and try run the unit tests. Before this patch, this would silently fail.
Ensure that the unit tests populate the database and complete successfully
Add a test with a call to
redirectand check that execution stops, but prints an
Warningto the terminal.