setOrderTotalAmount example


    public function testRuleMatching(string $operator, bool $isMatching, ?float $orderAmount, float $ruleOrderAmount, bool $noCustomer = false): void
    {
        $rule = new OrderTotalAmountRule();
        $rule->assign(['amount' => $ruleOrderAmount, 'operator' => $operator]);

        $scope = $this->createMock(CheckoutRuleScope::class);
        $salesChannelContext = $this->createMock(SalesChannelContext::class);
        $orderCollection = new OrderCollection();
        $customer = new CustomerEntity();
        $customer->setOrderTotalAmount($orderAmount ?? 0);

        if ($noCustomer) {
            $customer = null;
        }

        $salesChannelContext->method('getCustomer')->willReturn($customer);
        $entity = new OrderEntity();
        $entity->setUniqueIdentifier('foo');
        $orderCollection->add($entity);

        $scope->method('getSalesChannelContext')
            
Home | Imprint | This part of the site doesn't use cookies.