On Sat, Feb 3, 2018 at 1:15 PM, Wes <netmo....@gmail.com> wrote: > question was: > > Do I get that right that it will then no longer be possible to mock > functions from the root namespace during tests? > > At least when the functions are "use"d or are explicitly namespaced... > > Being able to mock functions like "date" or "time" or "mt_rand" is > currently extremely helpful. >
I think there's something quite broken with the current approach in mocking core functions, specifically because already having them hardcoded in your codebase means that the code relies on hidden shared global state. Can strongly suggest injecting a `Clock` object as is done in https://github.com/lcobucci/clock, for example. Same goes for sources of randomness. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/