Write tests for your PHP code,
not code for the tests.
Among other uses, Patchwork's method redefinition functionality allows any callable to be replaced with a test double – be it static, private or internal:
redefine('time', always(strtotime('Dec 31, 1999'))); echo date('Y-m-d', time()); # => 1999-12-31
PHAR, version 2.1.4 for PHP ≥ 5.4.
On Composer: antecedent/patchwork.