Welcome Guest, Not a member yet? Register   Sign In
Testing current URI


As stated in this StackOverflow question, to which you can answer and win a few points, I am trying to run a unit test of a library that checks the value of string_uri().

In order to test it right, I have to mock the current URI, something like

PHP Code:
$_SERVER['PHP_SELF'] = 'my/custom/test/uri'

Unfortunately, that doesn't work.

I ended up by writing a function in the test suite that changes it and another one that overrides string_uri(). I don't like that, because I'm writing code that will never be tested.

Is there another way to mock the URI?

Theme © iAndrew 2016 - Forum software by © MyBB