You can use this sandbox to make your unit-tests more reliable:
https://github.com/webpackage-pro/PHPUnitSandbox
You can change method result in runtime, with the sandbox.
It supports PHP v5.4 - 7.x and does not required any additional installations on your server