Skip to content

Commit a12cd1b

Browse files
ACQE-8152: Verify Rest-API updating product stock_item does not delete downloadable_product_links
- Updated code to use dynamic sku
1 parent 7369379 commit a12cd1b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

dev/tests/api-functional/testsuite/Magento/Downloadable/Api/StockItemUpdatePreservesLinksTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ protected function setUp(): void
4040
}
4141

4242
/**
43-
* Test the complete workflow from Steps 1-16
43+
* Test the complete workflow
4444
* Verify that REST-API updating product stock_item does not delete downloadable_product_links
4545
*
4646
* @return void
4747
*/
48-
#[DataFixture(DownloadableProduct::class, [
49-
'sku' => 'downloadable-product',
48+
#[
49+
DataFixture(DownloadableProduct::class, [
5050
'name' => 'Downloadable Product Test',
5151
'price' => 50.00,
5252
'type_id' => 'downloadable',
@@ -81,27 +81,26 @@ protected function setUp(): void
8181
]
8282
]
8383
], 'downloadable_product')]
84-
public function testStockItemUpdatePreservesDownloadableLinks()
84+
public function testStockItemUpdatePreservesDownloadableLinks(): void
8585
{
8686
// Get the product SKU from the fixture
87-
$product = $this->fixtures->get('downloadable_product');
88-
$productSku = $product->getSku();
87+
$productSku = $this->fixtures->get('downloadable_product')->getSku();
8988

9089
// Get original product and verify it has downloadable links
9190
$originalProduct = $this->getProductBySku($productSku);
9291
$this->verifyProductHasDownloadableLinks($originalProduct, 'Original product should have downloadable links');
9392
$originalLinks = $originalProduct['extension_attributes']['downloadable_product_links'];
9493

95-
// Steps 8-14: Update product stock_item via catalogProductRepositoryV1 PUT endpoint
94+
// Update product stock_item via catalogProductRepositoryV1 PUT endpoint
9695
$updatedProduct = $this->updateProductStockItem($productSku);
9796

98-
// Verify the API call was successful (Step 14: Server response Code=200)
97+
// Verify the API call was successful
9998
$this->assertNotEmpty($updatedProduct, 'API response should not be empty');
10099
$this->assertEquals($productSku, $updatedProduct['sku']);
101100
$this->assertEquals('99.99', $updatedProduct['price']);
102101
$this->assertEquals('1', $updatedProduct['status']);
103102

104-
// Steps 15-16: Verify downloadable product links are preserved
103+
// Verify downloadable product links are preserved
105104
$this->verifyDownloadableLinksPreserved($originalLinks, $productSku);
106105
}
107106

0 commit comments

Comments
 (0)