FlowRuleScopeBuilder example

private MockObject&DeliveryBuilder $deliveryBuilder;

    private MockObject&CartDataCollectorInterface $cartDataCollector;

    private FlowRuleScopeBuilder $scopeBuilder;

    protected function setUp(): void
    {
        $this->orderConverter = $this->createMock(OrderConverter::class);
        $this->deliveryBuilder = $this->createMock(DeliveryBuilder::class);
        $this->cartDataCollector = $this->createMock(CartDataCollectorInterface::class);
        $this->scopeBuilder = new FlowRuleScopeBuilder($this->orderConverter, $this->deliveryBuilder, [$this->cartDataCollector]);
    }

    public function testBuild(): void
    {
        $mockContext = $this->createMock(SalesChannelContext::class);
        $cart = new Cart('test');
        $this->orderConverter->method('assembleSalesChannelContext')->willReturn($mockContext);
        $this->orderConverter->method('convertToCart')->willReturn($cart);
        $this->deliveryBuilder->method('build')->willReturn(new DeliveryCollection());
        $this->cartDataCollector->expects(static::exactly(2))->method('collect');

        
Home | Imprint | This part of the site doesn't use cookies.