I would like to test code that uses WordPress global functions. For example: get_the_title()
or get_post()
.
In order to be able to write the test I have to mock this kind of functions (because they query the DB and the result is always different).
I cannot find an elegant method to mock these functions. Some solutions suggest to use a WordPress oriented framework on top of PHPUnit
.
Maybe these is a better, more elegant solution?