That's why run-tests.php creates a .sh file (upon test failure). This script will setup up with the exact same environment as the tests (would) run.