Skip to content

Commit 249414e

Browse files
committed
ACP2E-3536: Cart Rule with shipping condition not applying when placing order from admin
- With test
1 parent aacd874 commit 249414e

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

app/code/Magento/SalesRule/Observer/ProcessOrderCreationDataObserver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright 2024 Adobe
3+
* Copyright 2025 Adobe
44
* All Rights Reserved.
55
*/
66
declare(strict_types=1);

app/code/Magento/SalesRule/Test/Unit/Observer/ProcessOrderCreationDataObserverTest.php

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright 2024 Adobe
3+
* Copyright 2025 Adobe
44
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
@@ -10,7 +10,6 @@
1010
use Magento\Framework\App\RequestInterface;
1111
use Magento\Framework\Event;
1212
use Magento\Framework\Event\Observer;
13-
use Magento\Multicoupon\Model\Config\Config;
1413
use Magento\Quote\Model\Quote;
1514
use Magento\Quote\Model\Quote\Address;
1615
use Magento\Sales\Model\AdminOrder\Create;
@@ -28,11 +27,6 @@ class ProcessOrderCreationDataObserverTest extends TestCase
2827
*/
2928
private $observerMock;
3029

31-
/**
32-
* @var MockObject|Config
33-
*/
34-
private $multiCouponConfigMock;
35-
3630
/**
3731
* @var Event|MockObject
3832
*/
@@ -73,10 +67,6 @@ protected function setUp(): void
7367
->onlyMethods(['isVirtual', 'getShippingAddress'])
7468
->disableOriginalConstructor()
7569
->getMock();
76-
$this->multiCouponConfigMock = $this->getMockBuilder(Config::class)
77-
->onlyMethods(['getMaximumNumberOfCoupons'])
78-
->disableOriginalConstructor()
79-
->getMock();
8070
$this->eventMock = $this->getMockBuilder(Event::class)
8171
->disableOriginalConstructor()
8272
->addMethods(['getRequest', 'getOrderCreateModel', 'getShippingMethod'])
@@ -90,22 +80,20 @@ protected function setUp(): void
9080
->disableOriginalConstructor()
9181
->getMock();
9282
$this->requestMock = $this->getMockForAbstractClass(RequestInterface::class);
93-
$this->model = new ProcessOrderCreationDataObserver($this->multiCouponConfigMock);
83+
$this->model = new ProcessOrderCreationDataObserver();
9484
}
9585

9686
/**
9787
* Test case for processOrderCreationDataObserver::execute
9888
*
9989
* @param bool $isVirtualQuote
100-
* @param int $maximumNumberOfCoupons
10190
* @param array $requestArr
10291
* @param string|null $quoteShippingMethod
10392
* @return void
10493
* @dataProvider executeDataProvider
10594
*/
10695
public function testExecute(
10796
bool $isVirtualQuote,
108-
int $maximumNumberOfCoupons,
10997
array $requestArr,
11098
?string $quoteShippingMethod = null,
11199
): void {
@@ -137,10 +125,6 @@ public function testExecute(
137125
->expects($this->any())
138126
->method('getShippingAddress')
139127
->willReturn($this->shippingAddressMock);
140-
$this->multiCouponConfigMock
141-
->expects($this->any())
142-
->method('getMaximumNumberOfCoupons')
143-
->willReturn($maximumNumberOfCoupons);
144128
$this->shippingAddressMock
145129
->expects($this->any())
146130
->method('setShippingMethod')
@@ -159,7 +143,6 @@ public static function executeDataProvider(): array
159143
return [
160144
[
161145
'isVirtualQuote' => false,
162-
'maximumNumberOfCoupons' => 1,
163146
'requestArr' =>
164147
[
165148
'order' => ['coupon' => 'coupon_code'],
@@ -170,7 +153,6 @@ public static function executeDataProvider(): array
170153
],
171154
[
172155
'isVirtualQuote' => true,
173-
'maximumNumberOfCoupons' => 1,
174156
'requestArr' =>
175157
[
176158
'order' => ['coupon' => 'coupon_code'],
@@ -180,7 +162,6 @@ public static function executeDataProvider(): array
180162
],
181163
[
182164
'isVirtualQuote' => false,
183-
'maximumNumberOfCoupons' => 1,
184165
'requestArr' =>
185166
[
186167
'order' => ['coupon' => ''],
@@ -190,7 +171,6 @@ public static function executeDataProvider(): array
190171
],
191172
[
192173
'isVirtualQuote' => false,
193-
'maximumNumberOfCoupons' => 10,
194174
'requestArr' =>
195175
[
196176
'order' => ['coupon' => 'coupon_code'],

0 commit comments

Comments
 (0)