PHP 8.5.0 Alpha 4 available for testing

Voting

: max(zero, nine)?
(Example: nine)

The Note You're Voting On

markus at malkusch dot de
10 years ago
You can use the fallback policy to provide mocks for built-in functions like time(). You therefore have to call those functions unqualified:

<?php
namespace foo;

function
time() {
return
1234;
}

assert (1234 == time());
?>

However there's a restriction that you have to define the mock function before the first usage in the tested class method. This is documented in Bug #68541.

You can find the mock library php-mock at GitHub.

<< Back to user notes page

To Top