Skip to content

Commit bcdd17d

Browse files
committed
Fix the problem 'Attribute with the same code already exists'
in attribute_user_defined_address_custom_attribute_rollback.php Add signatures and unify style in naming of variables Signed-off-by: Tomash Khamlai <tomash.khamlai@gmail.com>
1 parent 68c48d5 commit bcdd17d

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address_custom_attribute.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
$model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Customer\Model\Attribute::class);
8-
$model->setName(
7+
/** @var \Magento\Customer\Model\Attribute $model1 */
8+
$model1 = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Customer\Model\Attribute::class);
9+
$model1->setName(
910
'custom_attribute1'
1011
)->setEntityTypeId(
1112
2
@@ -20,8 +21,9 @@
2021
)->setIsUserDefined(
2122
1
2223
);
23-
$model->save();
24+
$model1->save();
2425

26+
/** @var \Magento\Customer\Model\Attribute $model2 */
2527
$model2 = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Customer\Model\Attribute::class);
2628
$model2->setName(
2729
'custom_attribute2'
@@ -45,10 +47,10 @@
4547
\Magento\Customer\Setup\CustomerSetup::class
4648
);
4749

48-
$data = [['form_code' => 'customer_address_edit', 'attribute_id' => $model->getAttributeId()]];
50+
$data1 = [['form_code' => 'customer_address_edit', 'attribute_id' => $model1->getAttributeId()]];
4951
$setupResource->getSetup()->getConnection()->insertMultiple(
5052
$setupResource->getSetup()->getTable('customer_form_attribute'),
51-
$data
53+
$data1
5254
);
5355

5456
$data2 = [['form_code' => 'customer_address_edit', 'attribute_id' => $model2->getAttributeId()]];

dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address_custom_attribute_rollback.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77

8-
$model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Customer\Model\Attribute::class);
9-
$model->load('custom_attribute_test', 'attribute_code')->delete();
10-
11-
$model2 = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Customer\Model\Attribute::class);
12-
$model2->load('custom_attributes_test', 'attribute_code')->delete();
8+
/** @var \Magento\Customer\Model\Attribute $attributeModel */
9+
$attributeModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Customer\Model\Attribute::class);
10+
$attributeModel->load('custom_attribute1', 'attribute_code')->delete();
11+
$attributeModel->load('custom_attribute2', 'attribute_code')->delete();

0 commit comments

Comments
 (0)