Make the code more testable without requiring forking in PHPUnit