Refactoring for PHPUnit test integration