The code I'm extending (which is WordPress) might or might not define a certain constant. If it does my code will have to react based on its value.

Testing !defined is obvious. But is there a way to mock a constant without having to actually define it? I mean, since in PHP you can only define a constant once and not unset/destroy it afterwards. Therefore defining a consant would pollute all following tests.

Any suggestions?

    Write a Reply...