phpt tests refactoring