No Ticket: Rationalize PHP scripts for ajax unit tests

Summoned @Krinkle and OMG-Your-Commit-Sucks(tm) happened. So we're going through a proper PR this time to get everything fixed ;)