Skip to content

Commit d99ff1b

Browse files
committed
#26121: special price & tier price are coming in base currency
Adjust unit and integration tests
1 parent 7a526e9 commit d99ff1b

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
use Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory;
1313
use Magento\Catalog\Model\Product;
1414
use Magento\Catalog\Model\Product\TierPrice;
15+
use Magento\Catalog\Model\Product\Price\TierPriceBuilder;
1516
use Magento\Catalog\Model\Product\Type\Price;
1617
use Magento\Customer\Api\GroupManagementInterface;
1718
use Magento\Customer\Model\Data\Group;
1819
use Magento\Customer\Model\GroupManagement;
1920
use Magento\Framework\App\Config\ScopeConfigInterface;
21+
use Magento\Framework\Pricing\PriceCurrencyInterface;
2022
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
2123
use Magento\Store\Model\StoreManagerInterface;
2224
use Magento\Store\Model\Website;
@@ -69,6 +71,8 @@ class PriceTest extends TestCase
6971

7072
private $tierPriceExtensionFactoryMock;
7173

74+
private $priceCurrencyMock;
75+
7276
protected function setUp(): void
7377
{
7478
$this->objectManagerHelper = new ObjectManagerHelper($this);
@@ -113,14 +117,27 @@ protected function setUp(): void
113117
->setMethods(['create'])
114118
->disableOriginalConstructor()
115119
->getMock();
120+
$this->priceCurrencyMock = $this->getMockBuilder(PriceCurrencyInterface::class)
121+
->getMockForAbstractClass();
122+
$tierPriceBuilder = $this->objectManagerHelper->getObject(
123+
TierPriceBuilder::class,
124+
[
125+
'tierPriceFactory' => $this->tpFactory,
126+
'tierPriceExtensionFactory' => $this->tierPriceExtensionFactoryMock,
127+
'config' => $this->scopeConfigMock,
128+
'storeManager' => $storeMangerMock,
129+
'priceCurrency' => $this->priceCurrencyMock,
130+
]
131+
);
116132
$this->model = $this->objectManagerHelper->getObject(
117133
Price::class,
118134
[
119135
'tierPriceFactory' => $this->tpFactory,
120136
'config' => $this->scopeConfigMock,
121137
'storeManager' => $storeMangerMock,
122138
'groupManagement' => $this->groupManagementMock,
123-
'tierPriceExtensionFactory' => $this->tierPriceExtensionFactoryMock
139+
'tierPriceExtensionFactory' => $this->tierPriceExtensionFactoryMock,
140+
'tierPriceBuilder' => $tierPriceBuilder
124141
]
125142
);
126143
}
@@ -234,6 +251,10 @@ function () {
234251
$this->tierPriceExtensionFactoryMock->expects($this->any())
235252
->method('create')
236253
->willReturn($tierPriceExtensionMock);
254+
$this->priceCurrencyMock->expects($this->any())->method('convertAndRound')
255+
->will(
256+
$this->onConsecutiveCalls(10, 20)
257+
);
237258

238259
// test with the data retrieved as a REST object
239260
$tpRests = $this->model->getTierPrices($this->product);

dev/tests/integration/testsuite/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricingTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,51 +46,51 @@ protected function setUp(): void
4646
'AdvancedPricingSimple 1' => [
4747
[
4848
'customer_group_id' => \Magento\Customer\Model\Group::CUST_GROUP_ALL,
49-
'value' => '300.000000',
49+
'value' => 300.00,
5050
'qty' => '10.0000',
5151
'percentage_value' => null
5252
],
5353
[
5454
'customer_group_id' => '1',
55-
'value' => '11.000000',
55+
'value' => 11.00,
5656
'qty' => '11.0000',
5757
'percentage_value' => null
5858
],
5959
[
6060
'customer_group_id' => '3',
61-
'value' => '14.000000',
61+
'value' => 14.00,
6262
'qty' => '14.0000',
6363
'percentage_value' => null
6464
],
6565
[
6666
'customer_group_id' => \Magento\Customer\Model\Group::CUST_GROUP_ALL,
67-
'value' => 160.5,
67+
'value' => 160.50,
6868
'qty' => '20.0000',
6969
'percentage_value' => '50.00'
7070
]
7171
],
7272
'AdvancedPricingSimple 2' => [
7373
[
7474
'customer_group_id' => \Magento\Customer\Model\Group::CUST_GROUP_ALL,
75-
'value' => '1000000.000000',
75+
'value' => 1000000.00,
7676
'qty' => '100.0000',
7777
'percentage_value' => null
7878
],
7979
[
8080
'customer_group_id' => '0',
81-
'value' => '12.000000',
81+
'value' => 12.00,
8282
'qty' => '12.0000',
8383
'percentage_value' => null
8484
],
8585
[
8686
'customer_group_id' => '2',
87-
'value' => '13.000000',
87+
'value' => 13.00,
8888
'qty' => '13.0000',
8989
'percentage_value' => null
9090
],
9191
[
9292
'customer_group_id' => \Magento\Customer\Model\Group::CUST_GROUP_ALL,
93-
'value' => 327.0,
93+
'value' => 327.00,
9494
'qty' => '200.0000',
9595
'percentage_value' => '50.00'
9696
]

0 commit comments

Comments
 (0)