I have code like the below that I want to test
class Controller_test{
public function action_index(){
if(!$this->referred_from_site()){
echo "Un-authorized request";
return;
}
echo "Request OK";
}
public function referred_from_site(){
if(strpos($this->request->referrer(),$_SERVER['HTTP_HOST']) !== FALSE ){
return TRUE;
}
return FALSE;
}
}
Now, in PHPUnit script I can set the value of $_SERVER['HTTP_HOST'] from setUP() function. But, how to set value for $this->request->referrer()? or how to do it if I want to set the value of function referred_from_site() as TRUE?