Minor refactoring to make PHPUnit tests work