Skip to content

Commit 602efa7

Browse files
committed
Merge branch 'ACP2E-3737' of https://github.com/adobe-commerce-tier-4/magento2ce into PR-03-17-2025
2 parents 9f9d888 + 99d429c commit 602efa7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

app/code/Magento/SalesRule/Model/Coupon/Usage/Processor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ public function updateCouponUsages(UpdateInfo $updateInfo): void
115115
private function lockLoadedCoupon(Coupon $coupon, UpdateInfo $updateInfo, array $incrementedCouponIds): void
116116
{
117117
$isIncrement = $updateInfo->isIncrement();
118-
$lockName = self::LOCK_NAME . $coupon->getCode();
118+
// Lock name based on coupon id, rather than coupon code that may contain illegal symbols for file based lock
119+
$lockName = self::LOCK_NAME . $coupon->getId();
119120
if ($this->lockManager->lock($lockName, self::LOCK_TIMEOUT)) {
120121
try {
121122
$coupon = $this->couponRepository->getById($coupon->getId());

app/code/Magento/SalesRule/Test/Unit/Model/Coupon/Usage/ProcessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function testProcess($isIncrement, $timesUsed): void
120120
$searchResult->method('getItems')
121121
->willReturn([$couponMock]);
122122
$this->couponRepository->method('getList')->willReturn($searchResult);
123-
$couponMock->expects($this->atLeastOnce())->method('getId')->willReturn($couponId);
123+
$couponMock->expects($this->exactly(4))->method('getId')->willReturn($couponId);
124124
$this->couponRepository->method('getById')->with($couponId)->willReturn($couponMock);
125125
$couponMock->expects($this->atLeastOnce())->method('getTimesUsed')->willReturn($timesUsed);
126126
$couponMock->expects($this->any())->method('setTimesUsed')->with($setTimesUsed)->willReturnSelf();

0 commit comments

Comments
 (0)