• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.