Crm 15148

Note the first 3 commits are backports of test framework to allow for testing (cherry-picked so shouldn't cause merge problems). The one line fix in the last commit is the actual fix - all the rest of the changes are to set-up the tests.

Note also the tests identify that core ACL permissions but not hook ACL permissions are applied to contribution searches - there is a test marked incomplete that tests for hook ACLs. This is slightly different to expected - I wasn't aware any ACLs worked on contribution.get, participant.get, pledge.get.

Not sure if it's worth logging an issue to get the hook ACLs working unless there is commitment / $ to fix