shouldReceive('getBuilderFromBasketOrFail') ->once() ->andReturn($builder); $orderTunnelService->shouldReceive('getShopForCustomer') ->once() ->with($shopperId) ->andReturn($shop); $orderTunnelService->shouldReceive('getAvailableTimeSlots') ->once() ->with($shop) ->andReturn($timeSlots); $orderTunnelService->shouldReceive('applyTimeSlot') ->once() ->with($builder, $shop, $timeslot, $timeSlots) ->andReturn($slot); $action = new ApplyPickTimeSlot($orderTunnelService); // WHEN $result = $action($input); // THEN expect($result)->toBe($slot); }); });