Refactor PHPUnit test to fix PHPMD messages