Skip to content

Commit 159688f

Browse files
committed
ACP2E-2837: Product entity updated_at column values not updating while updating price through REST API
- Added the test coverage.
1 parent 5bb082e commit 159688f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

dev/tests/api-functional/testsuite/Magento/Catalog/Api/BasePriceStorageTest.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,46 @@ public function testUpdateWithInvalidParameters()
157157

158158
$this->assertEquals($expectedResponse, $response);
159159
}
160+
161+
/**
162+
* Test update last updated at method.
163+
*
164+
* @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
165+
*/
166+
public function testUpdateLastUpdatedAt()
167+
{
168+
$productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
169+
/** @var \Magento\Catalog\Api\Data\ProductInterface $product */
170+
$product = $productRepository->get(self::SIMPLE_PRODUCT_SKU);
171+
$productUpdatedAt = $product->getUpdatedAt();
172+
$newUpdateAt = $this->objectManager->create(\Magento\Framework\Stdlib\DateTime\DateTime::class)->gmtDate();
173+
$serviceInfo = [
174+
'rest' => [
175+
'resourcePath' => '/V1/products/base-prices?XDEBUG_SESSION_START=PHPSTORM',
176+
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST
177+
],
178+
'soap' => [
179+
'service' => self::SERVICE_NAME,
180+
'serviceVersion' => self::SERVICE_VERSION,
181+
'operation' => self::SERVICE_NAME . 'Update',
182+
],
183+
];
184+
$newPrice = 9999;
185+
$storeId = 0;
186+
$response = $this->_webApiCall(
187+
$serviceInfo,
188+
[
189+
'prices' => [
190+
[
191+
'price' => $newPrice,
192+
'store_id' => $storeId,
193+
'sku' => self::SIMPLE_PRODUCT_SKU,
194+
]
195+
]
196+
]
197+
);
198+
199+
$this->assertEmpty($response);
200+
$this->assertGreaterThanOrEqual(strtotime($productUpdatedAt), strtotime($newUpdateAt));
201+
}
160202
}

0 commit comments

Comments
 (0)