I have a function that is utilising a global variable, of which I am unsure where it is being set, that is the basis of a conditional. For example:
function myFunction($myLocalVariable) {
$toReturn = '';
if (isset($myGlobalVariable) && $myGlobalVariable == 'some-string') {
$toReturn = 'Global var is set & equal to some-string';
}
return $toReturn;
}
Since I don't know how/where $myGlobalVariable is being set due to legacy/obfuscated code, is there any way I can force it to be seen as a specific value in my unit test?
Aucun commentaire:
Enregistrer un commentaire