Skip to content

Commit fd79ac9

Browse files
author
Eric Bohanon
committed
MAGETWO-83872: Fix SOAP/REST tests
1 parent a153e1a commit fd79ac9

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,15 @@ protected function deleteProductBySku($productSku)
498498
*/
499499
protected function saveProduct($product)
500500
{
501+
if (isset($product['custom_attributes'])) {
502+
for ($i=0; $i<sizeof($product['custom_attributes']); $i++) {
503+
if ($product['custom_attributes'][$i]['attribute_code'] == 'category_ids'
504+
&& !is_array($product['custom_attributes'][$i]['value'])
505+
) {
506+
$product['custom_attributes'][$i]['value'] = [""];
507+
}
508+
}
509+
}
501510
$resourcePath = self::RESOURCE_PATH . '/' . $product['sku'];
502511
$serviceInfo = [
503512
'rest' => [

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,15 @@ public function testUpdate()
617617
*/
618618
protected function updateProduct($product)
619619
{
620+
if (isset($product['custom_attributes'])) {
621+
for ($i=0; $i<sizeof($product['custom_attributes']); $i++) {
622+
if ($product['custom_attributes'][$i]['attribute_code'] == 'category_ids'
623+
&& !is_array($product['custom_attributes'][$i]['value'])
624+
) {
625+
$product['custom_attributes'][$i]['value'] = [""];
626+
}
627+
}
628+
}
620629
$sku = $product[ProductInterface::SKU];
621630
if (TESTS_WEB_API_ADAPTER == self::ADAPTER_REST) {
622631
$product[ProductInterface::SKU] = null;
@@ -986,6 +995,15 @@ protected function getSimpleProductData($productData = [])
986995
*/
987996
protected function saveProduct($product, $storeCode = null)
988997
{
998+
if (isset($product['custom_attributes'])) {
999+
for ($i=0; $i<sizeof($product['custom_attributes']); $i++) {
1000+
if ($product['custom_attributes'][$i]['attribute_code'] == 'category_ids'
1001+
&& !is_array($product['custom_attributes'][$i]['value'])
1002+
) {
1003+
$product['custom_attributes'][$i]['value'] = [""];
1004+
}
1005+
}
1006+
}
9891007
$serviceInfo = [
9901008
'rest' => [
9911009
'resourcePath' => self::RESOURCE_PATH,

0 commit comments

Comments
 (0)