File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
dev/tests/api-functional/testsuite/Magento/Catalog/Api Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -157,4 +157,46 @@ public function testUpdateWithInvalidParameters()
157
157
158
158
$ this ->assertEquals ($ expectedResponse , $ response );
159
159
}
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
+ }
160
202
}
You can’t perform that action at this time.
0 commit comments