You can use the fallback policy to provide mocks for built-in functions like time(). You therefore have to call those functions unqualified:<?phpnamespace 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.