hi i have written unit test and in my test suit i need related service about the unit test. i get the setup method like
protected function setUp(): void
{
parent::setUp();
$this->delayReportService = self::getContainer()->get(DelayReportService::class);
}
in this test class i just want test a method that is not related to class dependencies so i mock all of its dependencies like this:
protected function setUp(): void
{
parent::setUp();
$this->delayReportService = new DelayReportService(
$this->createMock(RedisQueueStorageClientInterface::class),
$this->createMock(OrderRepository::class),
$this->createMock(DelayReportRepository::class),
$this->createMock(EstimatedArrivalTimeClientInterface::class),
$this->createMock(ParameterBagInterface::class)
);
}
is this the best practice that when we don`t need dependencies in our test, we mock them? and in integration test we should not use mock right?