Skip to content

Commit 3be62d9

Browse files
committed
MAGETWO-92885: Unable to delete Fixed Tax Attribute from attribute set
1 parent eedbf51 commit 3be62d9

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/AttributeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class AttributeTest extends \PHPUnit\Framework\TestCase
7373
private $entityMetaDataInterfaceMock;
7474

7575
/**
76-
* {@inheritDoc}
76+
* @inheritDoc
7777
*/
7878
protected function setUp()
7979
{
@@ -123,7 +123,7 @@ protected function setUp()
123123
*
124124
* @return void
125125
*/
126-
private function setObjectProperty($object, string $propertyName, $value)
126+
private function setObjectProperty($object, string $propertyName, $value) : void
127127
{
128128
$reflectionClass = new \ReflectionClass($object);
129129
$reflectionProperty = $reflectionClass->getProperty($propertyName);
@@ -134,7 +134,7 @@ private function setObjectProperty($object, string $propertyName, $value)
134134
/**
135135
* @return void
136136
*/
137-
public function testDeleteEntity()
137+
public function testDeleteEntity() : void
138138
{
139139
$entityAttributeId = 196;
140140
$entityTypeId = 4;

app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function getTable()
187187
}
188188

189189
/**
190-
* {@inheritdoc}
190+
* @inheritdoc
191191
*/
192192
public function getEntityIdField()
193193
{

app/code/Magento/Weee/Test/Unit/Model/Attribute/Backend/Weee/TaxTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,10 @@ public function testGetTable()
275275
*
276276
* @return void
277277
*/
278-
public function testGetEntityIdField()
278+
public function testGetEntityIdField() : void
279279
{
280280
$attributeTaxMock = $this->getMockBuilder(\Magento\Weee\Model\ResourceModel\Attribute\Backend\Weee\Tax::class)
281-
->setMethods(['getEntityIdField', 'getIdFieldName'])
281+
->setMethods(['getIdFieldName'])
282282
->disableOriginalConstructor()
283283
->getMock();
284284

dev/tests/integration/testsuite/Magento/Weee/Model/ResourceModel/AttributeTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
use Magento\Framework\EntityManager\MetadataPool;
1414

1515
/**
16-
* Test class for Catalog attribute resource model.
16+
* Test class for Magento\Catalog\Model\ResourceModel\Attribute class
17+
* with backend model Magento\Weee\Model\Attribute\Backend\Weee\Tax.
1718
*
1819
* @see Magento\Catalog\Model\ResourceModel\Attribute
1920
*/
@@ -44,6 +45,9 @@ class AttributeTest extends \PHPUnit\Framework\TestCase
4445
*/
4546
protected $objectManager;
4647

48+
/**
49+
* @inheritdoc
50+
*/
4751
protected function setUp()
4852
{
4953
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
@@ -65,7 +69,7 @@ protected function setUp()
6569
* @param int $attributeId
6670
* @return array|false
6771
*/
68-
private function getEavEntityAttributeRow($entityTypeId, $attributeSetId, $attributeId)
72+
private function getEavEntityAttributeRow(int $entityTypeId, int $attributeSetId, int $attributeId)
6973
{
7074
$connection = $this->productResource->getConnection();
7175
$select = $connection->select()
@@ -83,16 +87,16 @@ private function getEavEntityAttributeRow($entityTypeId, $attributeSetId, $attri
8387
* @magentoDataFixture Magento/Weee/_files/fixed_product_attribute.php
8488
* @return void
8589
*/
86-
public function testDeleteEntityFixedTax()
90+
public function testDeleteEntityFixedTax() : void
8791
{
8892
/* @var EavAttribute $attribute */
8993
$attribute = $this->objectManager->get(EavAttribute::class);
9094
$attribute->loadByCode(\Magento\Catalog\Model\Product::ENTITY, 'fixed_product_attribute');
9195

9296
$entityEavAttributeRow = $this->getEavEntityAttributeRow(
93-
$attribute->getEntityTypeId(),
97+
(int)$attribute->getEntityTypeId(),
9498
4,
95-
$attribute->getId()
99+
(int)$attribute->getId()
96100
);
97101
$this->assertNotEmpty(
98102
$entityEavAttributeRow['entity_attribute_id'],
@@ -103,13 +107,13 @@ public function testDeleteEntityFixedTax()
103107
$this->model->deleteEntity($attribute);
104108

105109
$entityEavAttributeRow = $this->getEavEntityAttributeRow(
106-
$attribute->getEntityTypeId(),
110+
(int)$attribute->getEntityTypeId(),
107111
4,
108-
$attribute->getId()
112+
(int)$attribute->getId()
109113
);
110114
$this->assertEmpty(
111115
$entityEavAttributeRow,
112-
'The record is not remove from table `eav_entity_attribute` for `fixed_product_attribute`'
116+
'The record was not removed from table `eav_entity_attribute` for `fixed_product_attribute`'
113117
);
114118
}
115119
}

dev/tests/integration/testsuite/Magento/Weee/_files/fixed_product_attribute.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
];
2929

3030
/** @var \Magento\Catalog\Model\Entity\Attribute $attribute */
31-
// $attribute = $objectManager->create(\Magento\Catalog\Model\Entity\Attribute::class);
3231
$attribute = $objectManager->create(\Magento\Eav\Model\Entity\Attribute::class);
3332
$attribute->setData($attributeData);
3433
$attribute->save();

0 commit comments

Comments
 (0)