Skip to content

Commit 8615dd1

Browse files
committed
MC-39553: Create automated test for: "Create product, add up-sell product to it and save, after, add one more up-sell product"
1 parent 99759d8 commit 8615dd1

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Related/UpSellDataProviderTest.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function setUp(): void
5858
/**
5959
* @dataProvider productDataProvider
6060
*
61-
* @magentoDataFixture Magento/Catalog/_files/second_product_simple.php
61+
* @magentoDataFixture Magento/Catalog/_files/products_upsell.php
6262
* @magentoDataFixture Magento/Catalog/_files/product_with_price_on_second_website.php
6363
*
6464
* @param string $storeCode
@@ -67,7 +67,7 @@ protected function setUp(): void
6767
*/
6868
public function testGetData(string $storeCode, float $price): void
6969
{
70-
$this->prepareRequest('simple2', $storeCode);
70+
$this->prepareRequest('simple_with_upsell', 'simple', $storeCode);
7171
$result = $this->getComponentProvidedData('upsell_product_listing')['items'];
7272
$this->assertCount(1, $result);
7373
$item = reset($result);
@@ -125,13 +125,26 @@ private function prepareChildComponents(UiComponentInterface $component): void
125125
* Prepare request
126126
*
127127
* @param string $productSku
128+
* @param string $relatedProductSku
128129
* @param string $storeCode
129130
* @return void
130131
*/
131-
private function prepareRequest(string $productSku, string $storeCode): void
132+
private function prepareRequest(string $productSku, string $relatedProductSku, string $storeCode): void
132133
{
133134
$storeId = (int)$this->storeManager->getStore($storeCode)->getId();
134135
$productId = (int)$this->productRepository->get($productSku)->getId();
135-
$this->request->setParams(['current_product_id' => $productId, 'current_store_id' => $storeId]);
136+
$relatedProductId = (int)$this->productRepository->get($relatedProductSku)->getId();
137+
$params = [
138+
'current_product_id' => $productId,
139+
'current_store_id' => $storeId,
140+
'filters_modifier' => [
141+
'entity_id' => [
142+
'condition_type' => 'nin',
143+
'value' => [$relatedProductId],
144+
],
145+
],
146+
];
147+
148+
$this->request->setParams($params);
136149
}
137150
}

0 commit comments

Comments
 (0)