Logo

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.2.0 for PHP ≥ 7.1.
On Composer: antecedent/patchwork.