DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

Why I am unable to assert that method has been called on my mocked service?

Can you help me with this question?

I have made a simple class named MyService

namespace App\Services
class MyService
{

    private $anotherService;

    public function setService(AnotherService $anotherService)
    {
        $this->anotherService = $anotherService;
    }

    public function getService()
    {
        if(empty($this->anotherService)){
            $this->setService(new AnotherService());
        }

        return $this->anotherService;
    }

    public function call()
    {
        $anotherService = $this->getService();

        $anotherService->SetXY(5,10);
    }
}

As you can se via…

Top comments (0)