@@ -354,6 +354,53 @@ public function testCheckWebsite()
354
354
}
355
355
}
356
356
357
+ /**
358
+ * Test replace method.
359
+ *
360
+ * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
361
+ */
362
+ public function testCheckNewRecords ()
363
+ {
364
+ $ serviceInfo = [
365
+ 'rest ' => [
366
+ 'resourcePath ' => '/V1/products/tier-prices ' ,
367
+ 'httpMethod ' => Request::HTTP_METHOD_POST
368
+ ],
369
+ 'soap ' => [
370
+ 'service ' => self ::SERVICE_NAME ,
371
+ 'serviceVersion ' => self ::SERVICE_VERSION ,
372
+ 'operation ' => self ::SERVICE_NAME . 'Update ' ,
373
+ ],
374
+ ];
375
+
376
+ $ newPrices = [
377
+ [
378
+ 'price ' => 10.31 ,
379
+ 'price_type ' => TierPriceInterface::PRICE_TYPE_FIXED ,
380
+ 'website_id ' => 0 ,
381
+ 'sku ' => self ::SIMPLE_PRODUCT_SKU ,
382
+ 'customer_group ' => self ::WRONG_CUSTOMER_GROUP_NAME ,
383
+ 'quantity ' => 2
384
+ ],
385
+ [
386
+ 'price ' => 20.62 ,
387
+ 'price_type ' => TierPriceInterface::PRICE_TYPE_FIXED ,
388
+ 'website_id ' => 1 ,
389
+ 'sku ' => self ::SIMPLE_PRODUCT_SKU ,
390
+ 'customer_group ' => self ::WRONG_CUSTOMER_GROUP_NAME ,
391
+ 'quantity ' => 2
392
+ ]
393
+ ];
394
+
395
+ $ response = $ this ->_webApiCall ($ serviceInfo , ['prices ' => $ newPrices ]);
396
+ $ this ->assertNotEmpty ($ response );
397
+ $ message = 'We found a duplicate website, tier price, customer group and quantity: '
398
+ . 'Customer Group = %customerGroup, Website ID = %websiteId, Quantity = %qty. '
399
+ . 'Row ID: SKU = %SKU, Website ID: %websiteId, Customer Group: %customerGroup, Quantity: %qty. ' ;
400
+ $ this ->assertEquals ($ message , $ response [0 ]['message ' ]);
401
+ $ this ->assertEquals ('simple ' , $ response [0 ]['parameters ' ][0 ]);
402
+ }
403
+
357
404
/**
358
405
* Check prise exists and is correct.
359
406
*
0 commit comments