beConstructedWith($vendorShippingMethodRepository, $shippingMethodsResolver); } public function it_is_initializable(): void { $this->shouldHaveType(VendorShippingMethodsResolver::class); $this->shouldImplement(VendorShippingMethodsResolverInterface::class); } public function it_returns_default_shipping_method_for_vendor( VendorInterface $vendor, ChannelInterface $channel, VendorShippingMethodInterface $vendorShippingMethod, VendorShippingMethodRepositoryInterface $vendorShippingMethodRepository ): void { $vendorShippingMethodRepository->findEnabledForChannel($vendor, $channel)->willReturn([$vendorShippingMethod]); $this->getDefaultShippingMethod($vendor, $channel)->shouldReturn($vendorShippingMethod); } public function it_does_not_return_default_shipping_method_for_vendor( VendorInterface $vendor, ChannelInterface $channel, VendorShippingMethodRepositoryInterface $vendorShippingMethodRepository ): void { $vendorShippingMethodRepository->findEnabledForChannel($vendor, $channel)->willReturn([]); $this ->shouldThrow(UnresolvedDefaultShippingMethodException::class) ->duringGetDefaultShippingMethod($vendor, $channel) ; } public function it_returns_default_shipping_methods_for_shipment_with_vendor( ShipmentInterface $subject, ShippingMethodsResolverInterface $shippingMethodsResolver, VendorShippingMethodRepositoryInterface $vendorShippingMethodRepository, VendorInterface $vendor, OrderInterface $order, ChannelInterface $channel, VendorShippingMethodInterface $vendorShippingMethod1, VendorShippingMethodInterface $vendorShippingMethod2, ShippingMethodInterface $shippingMethod1, ShippingMethodInterface $shippingMethod2 ): void { $subject->hasVendor()->willReturn(true); $subject->getVendor()->willReturn($vendor); $subject->getOrder()->willReturn($order); $order->getChannel()->willReturn($channel); $vendorShippingMethod1->getShippingMethod()->willReturn($shippingMethod1); $vendorShippingMethod2->getShippingMethod()->willReturn($shippingMethod2); $shippingMethodsResolver->getSupportedMethods($subject)->shouldNotBeCalled(); $vendorShippingMethodRepository ->findEnabledForChannel($vendor, $channel) ->willReturn([$vendorShippingMethod1, $vendorShippingMethod2]) ; $this->getSupportedMethods($subject)->shouldReturn([$shippingMethod1, $shippingMethod2]); } }