Mocking a build-in PHP function is achieved by using
PHP's namespace fallback policy. A mock will provide the namespaced function.
I.e. only unqualified functions in a non-global namespace can be mocked.
Example:
namespace foo;
use phpmock\Mock;
$time = new Mock(
__NAMESPACE__,
"time",
function () {
return 3;
}
);
$time->enable();
assert (3 == time());
$time->disable();
assert (3 != time());