CodeExplorer setOrderCount example
public function testRuleMatching(string
$operator, bool
$isMatching, ?int
$orderCount, int
$ruleOrderCount, bool
$noCustomer = false
): void
{ $rule =
new OrderCountRule();
$rule->
assign(['count' =>
$ruleOrderCount, 'operator' =>
$operator]);
$scope =
$this->
createMock(CheckoutRuleScope::
class);
$salesChannelContext =
$this->
createMock(SalesChannelContext::
class);
$orderCollection =
new OrderCollection();
$customer =
new CustomerEntity();
$customer->
setOrderCount($orderCount ?? 0
);
if ($noCustomer) { $customer = null;
} $salesChannelContext->
method('getCustomer'
)->
willReturn($customer);
$entity =
new OrderEntity();
$entity->
setUniqueIdentifier('test'
);
$orderCollection->
add($entity);
$scope->
method('getSalesChannelContext'
)