Skip to content

Commit 48c72d2

Browse files
author
Manasa Potluri
committed
MAGETWO-33118: Refactor code that uses customer builders in api-functional tests
- Changes from code review
1 parent b639708 commit 48c72d2

File tree

2 files changed

+17
-32
lines changed

2 files changed

+17
-32
lines changed

dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ public function testCustomAttributes()
621621
$addresses = $customerData->getAddresses();
622622
$addresses[0]->setCustomAttribute($fixtureAddressAttributeCode, $address1CustomAttributeValue);
623623
$addresses[1]->setCustomAttribute($fixtureAddressAttributeCode, $address2CustomAttributeValue);
624+
$customerData->setAddresses($addresses);
624625
$customerData->setCustomAttribute($fixtureCustomerAttributeCode, $customerCustomAttributeValue);
625626
$serviceInfo = [
626627
'rest' => [

dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ class GroupRepositoryTest extends WebapiAbstract
3232
*/
3333
private $groupRepository;
3434

35-
/**
36-
* @var \Magento\Framework\Api\DataObjectHelper
37-
*/
38-
private $dataObjectHelper;
39-
4035
/**
4136
* @var \Magento\Customer\Api\Data\groupInterfaceFactory
4237
*/
@@ -50,8 +45,7 @@ public function setUp()
5045
$objectManager = Bootstrap::getObjectManager();
5146
$this->groupRegistry = $objectManager->get('Magento\Customer\Model\GroupRegistry');
5247
$this->groupRepository = $objectManager->get('Magento\Customer\Model\Resource\GroupRepository');
53-
$this->dataObjectHelper = $objectManager->create('Magento\Framework\Api\DataObjectHelper');
54-
$this->customerGroupFactory = $objectManager->create('Magento\Customer\Api\Data\groupInterfaceFactory');
48+
$this->customerGroupFactory = $objectManager->create('Magento\Customer\Api\Data\GroupInterfaceFactory');
5549
}
5650

5751
/**
@@ -182,11 +176,9 @@ public function testCreateGroupDuplicateGroupRest()
182176
$duplicateGroupCode = 'Duplicate Group Code REST';
183177

184178
$group = $this->customerGroupFactory->create();
185-
$this->dataObjectHelper->populateWithArray($group, [
186-
CustomerGroup::ID => null,
187-
CustomerGroup::CODE => $duplicateGroupCode,
188-
CustomerGroup::TAX_CLASS_ID => 3,
189-
]);
179+
$group->setId(null);
180+
$group->setCode($duplicateGroupCode);
181+
$group->setTaxClassId(3);
190182
$this->createGroup($group);
191183

192184
$serviceInfo = [
@@ -396,11 +388,9 @@ public function testUpdateGroupRest()
396388
{
397389
$this->_markTestAsRestOnly();
398390
$group = $this->customerGroupFactory->create();
399-
$this->dataObjectHelper->populateWithArray($group, [
400-
CustomerGroup::ID => null,
401-
CustomerGroup::CODE => 'New Group REST',
402-
CustomerGroup::TAX_CLASS_ID => 3,
403-
]);
391+
$group->setId(null);
392+
$group->setCode('New Group REST');
393+
$group->setTaxClassId(3);
404394
$groupId = $this->createGroup($group);
405395

406396
$serviceInfo = [
@@ -509,11 +499,9 @@ public function testCreateGroupDuplicateGroupSoap()
509499
$group = $this->customerGroupFactory->create();
510500
$duplicateGroupCode = 'Duplicate Group Code SOAP';
511501

512-
$this->dataObjectHelper->populateWithArray($group, [
513-
CustomerGroup::ID => null,
514-
CustomerGroup::CODE => $duplicateGroupCode,
515-
CustomerGroup::TAX_CLASS_ID => 3,
516-
]);
502+
$group->setId(null);
503+
$group->setCode($duplicateGroupCode);
504+
$group->setTaxClassId(3);
517505
$this->createGroup($group);
518506

519507
$serviceInfo = [
@@ -661,11 +649,9 @@ public function testUpdateGroupSoap()
661649
{
662650
$this->_markTestAsSoapOnly();
663651
$group = $this->customerGroupFactory->create();
664-
$this->dataObjectHelper->populateWithArray($group, [
665-
CustomerGroup::ID => null,
666-
CustomerGroup::CODE => 'New Group SOAP',
667-
CustomerGroup::TAX_CLASS_ID => 3,
668-
]);
652+
$group->setId(null);
653+
$group->setCode('New Group SOAP');
654+
$group->setTaxClassId(3);
669655
$groupId = $this->createGroup($group);
670656

671657
$serviceInfo = [
@@ -735,11 +721,9 @@ public function testUpdateGroupNotExistingGroupSoap()
735721
public function testDeleteGroupExists()
736722
{
737723
$group = $this->customerGroupFactory->create();
738-
$this->dataObjectHelper->populateWithArray($group, [
739-
CustomerGroup::ID => null,
740-
CustomerGroup::CODE => 'Delete Group',
741-
CustomerGroup::TAX_CLASS_ID => 3,
742-
]);
724+
$group->setId(null);
725+
$group->setCode('Delete Group');
726+
$group->setTaxClassId(3);
743727
$groupId = $this->createGroup($group);
744728

745729
$serviceInfo = [

0 commit comments

Comments
 (0)