Skip to content

Commit b8813fc

Browse files
authored
MDEE-381: fix tests (#235)
* MDEE-381: Commerce Data Export extension - compatibility with 2.4.6
1 parent 6338123 commit b8813fc

2 files changed

Lines changed: 39 additions & 16 deletions

File tree

ProductPriceDataExporter/Model/Provider/ProductPrice.php

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,34 +41,40 @@ class ProductPrice
4141
Configurable::TYPE_CODE => self::PRODUCT_TYPE_CONFIGURABLE,
4242
Grouped::TYPE_CODE => self::PRODUCT_TYPE_CONFIGURABLE,
4343
Type::TYPE_BUNDLE => self::PRODUCT_TYPE_BUNDLE,
44-
// \Magento\GiftCard\Model\Catalog\Product\Type\Giftcard::TYPE_GIFTCARD => self::PRODUCT_TYPE_DEFAULT,
4544
];
4645

4746
/**
4847
* @var ResourceConnection
4948
*/
50-
private $resourceConnection;
49+
private ResourceConnection $resourceConnection;
5150

5251
/**
5352
* @var ProductPricesQuery
5453
*/
55-
private $pricesQuery;
54+
private ProductPricesQuery $pricesQuery;
5655

5756
/**
5857
* @var CustomerGroupPricesQuery
5958
*/
60-
private $customerGroupPricesQuery;
59+
private CustomerGroupPricesQuery $customerGroupPricesQuery;
6160

6261
/**
6362
* @var DateTime
6463
*/
65-
private $dateTime;
64+
private DateTime $dateTime;
6665

6766
/**
6867
* @var CatalogRulePricesQuery
6968
*/
70-
private $catalogRulePricesQuery;
69+
private CatalogRulePricesQuery $catalogRulePricesQuery;
7170

71+
/**
72+
* @param ProductPricesQuery $pricesQuery
73+
* @param CustomerGroupPricesQuery $customerGroupPricesQuery
74+
* @param CatalogRulePricesQuery $catalogRulePricesQuery
75+
* @param ResourceConnection $resourceConnection
76+
* @param DateTime $dateTime
77+
*/
7278
public function __construct(
7379
ProductPricesQuery $pricesQuery,
7480
CustomerGroupPricesQuery $customerGroupPricesQuery,
@@ -84,6 +90,8 @@ public function __construct(
8490
}
8591

8692
/**
93+
* Get ProductPrice
94+
*
8795
* @param array $values
8896
* @return array
8997
* @throws \Zend_Db_Statement_Exception
@@ -110,6 +118,15 @@ public function get(array $values): array
110118
return $output;
111119
}
112120

121+
/**
122+
* Add Customer Group Prices
123+
*
124+
* @param array $prices
125+
* @param array $productIds
126+
* @return void
127+
* @throws UnableRetrieveData
128+
* @throws \Zend_Db_Statement_Exception
129+
*/
113130
private function addCustomerGroupPrices(array &$prices, array $productIds): void
114131
{
115132
$cursor = $this->resourceConnection->getConnection()
@@ -146,6 +163,8 @@ private function addCustomerGroupPrices(array &$prices, array $productIds): void
146163
}
147164

148165
/**
166+
* Add Catalog Rule Prices
167+
*
149168
* @param array $prices
150169
* @param array $productIds
151170
* @return void
@@ -184,6 +203,8 @@ private function addCatalogRulePrices(array &$prices, array $productIds): void
184203
}
185204

186205
/**
206+
* Build Key
207+
*
187208
* @param string $productId
188209
* @param string $websiteId
189210
* @param string $customerGroup
@@ -195,6 +216,8 @@ private function buildKey(string $productId, string $websiteId, string $customer
195216
}
196217

197218
/**
219+
* Add Discount Price
220+
*
198221
* @param array $prices
199222
* @param string $code
200223
* @param float $price
@@ -218,6 +241,8 @@ private function addDiscountPrice(array &$prices, string $code, float $price, bo
218241
}
219242

220243
/**
244+
* Fill Output
245+
*
221246
* @param array $row
222247
* @param string $key
223248
* @return array
@@ -253,6 +278,8 @@ private function fillOutput(array $row, string $key): array
253278
}
254279

255280
/**
281+
* Calculate Percent DiscountValue
282+
*
256283
* @param string $price
257284
* @param string $percent
258285
* @return float
@@ -264,6 +291,8 @@ private function calculatePercentDiscountValue(string $price, string $percent):
264291
}
265292

266293
/**
294+
* Convert Product Type
295+
*
267296
* @param string $typeId
268297
* @return string
269298
*/
@@ -275,13 +304,12 @@ private function convertProductType(string $typeId): string
275304
}
276305

277306
/**
278-
* Build customer group code from the customer group id.
279-
* Using sha1 to generate the code
307+
* Build customer group code from the customer group id. Using sha1 to generate the code
280308
*
281-
* @param $customerGroupId
309+
* @param string $customerGroupId
282310
* @return string
283311
*/
284-
private function buildCustomerGroupCode($customerGroupId): string
312+
private function buildCustomerGroupCode(string $customerGroupId): string
285313
{
286314
return sha1($customerGroupId);
287315
}

DataExporter/Test/Api/_files/overrides.xml renamed to dev/tests/api-functional/_files/Magento/DataExporter/Test/Api/_files/overrides.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
-->
88
<overrides>
99
<!-- Tests are failed because of incompatible version of MSI (MDEE-187) -->
10-
<test class="Magento\Downloadable\Api\CartItemRepositoryTest">
11-
<method name="testUpdateItem" skip="true" />
12-
<method name="testUpdateItemWithInvalidLinkId" skip="true" />
13-
<method name="testGetList" skip="true" />
14-
<method name="testUpdateItemQty" skip="true" />
15-
</test>
10+
<test class="Magento\Downloadable\Api\CartItemRepositoryTest" skip="true"/>
1611
<!-- Tests are failed because of incompatible version of MSI (MDEE-187) -->
1712
<test class="Magento\GraphQl\DownloadableProduct\UpdateDownloadableCartItemsTest" skip="true"/>
1813
</overrides>

0 commit comments

Comments
 (0)