Initial work on #1101
Clean up PHPT tests
Merge branch '1101-phpt-refactoring'
Leftover