setReviewCount example


    public function testRuleMatching(string $operator, bool $isMatching, ?int $reviewCount, int $ruleOrderCount, bool $noCustomer = false): void
    {
        $rule = new NumberOfReviewsRule();
        $rule->assign(['count' => $ruleOrderCount, 'operator' => $operator]);

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

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

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

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