Testing class dependending on Illuminate\Http\Request state

Posted 3 years ago by holgerhartmann

Hi together,

I'm really new in writing testings and so I have this Issue:

I have the following class Routing

class Routing extends Controller
{
    private $request;

    public function __construct(Request $request)
    {
        $this->request = $request;
        $this->setSlug();
    }


    public function getSlug()
        {
            return $this->slug;
    }


    public function setSlug()
        {
            return $this->slug = $this->request->path();
        }
}

So my question is: How can I test this class with different "request" states? (The class has much more attributes and methods, but for my understanding this part would really help me..) Thanks in advance for your help.

Best, Holger

Please sign in or create an account to participate in this conversation.