Ok, so here's the issue I've run into. On some of our production systems, we have magic quotes gpc enabled. There's nothing I can do about that. So, I've built my request data handing classes to compensate:
protected static function clean($var)
{
if (get_magic_quotes_gpc()) {
if (is_array($var)) {
foreach ($var as $k => $v) {
$var[$k] = self::clean($v);
}
} else {
$var = stripslashes($var);
}
}
return $var;
}
I do some other things in that method, but that's not an issue.
So, I'm currently trying to write a set of Unit-Tests for that method, and I've run into a road bock. How can I test both execution paths with respect to the result of get_magic_quotes_gpc()
? I can't modify the ini settings at run time for that (because it's already loaded)... I've tried searching the PHPUnit docs, but I can't find anything related to this type of issue. Is there something that I'm missing here? Or will I have to live with being unable to test all possible code execution paths?
Thanks