Skip to content

Commit 83d959e

Browse files
akaashakaash
authored andcommitted
PR Feedbacks
1 parent bd1c6c1 commit 83d959e

File tree

1 file changed

+13
-5
lines changed
  • dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Attribute

1 file changed

+13
-5
lines changed

dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Attribute/CreateOptionsTest.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99

1010
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
1111
use Magento\Catalog\Api\ProductRepositoryInterface;
12+
use Magento\ConfigurableProduct\Test\Fixture\Attribute as AttributeFixture;
1213
use Magento\Framework\App\Request\Http as HttpRequest;
14+
use Magento\Framework\Exception\LocalizedException;
1315
use Magento\Framework\Serialize\SerializerInterface;
16+
use Magento\TestFramework\Fixture\DataFixture;
1417
use Magento\TestFramework\TestCase\AbstractBackendController;
1518
use Magento\Eav\Model\Config;
1619
use Magento\Catalog\Api\Data\ProductAttributeInterface;
17-
use Magento\Framework\Exception\LocalizedException;
1820

1921
/**
2022
* Checks creating attribute options process.
@@ -95,20 +97,26 @@ protected function tearDown(): void
9597
/**
9698
* Test updating a product attribute and checking the frontend_class for the sku attribute.
9799
*
98-
* @magentoDataFixture Magento/Catalog/_files/product_attribute.php
100+
* @return void
101+
* @throws LocalizedException
99102
*/
103+
#[
104+
DataFixture(AttributeFixture::class, as: 'attr'),
105+
]
100106
public function testAttributeWithBackendTypeHasSameValueInFrontendClass()
101107
{
108+
// Load the 'sku' attribute.
102109
/** @var ProductAttributeInterface $attribute */
103110
$attribute = $this->productAttributeRepository->get('sku');
111+
$expectedFrontEndClass = $attribute->getFrontendClass();
104112

105-
$attribute->setFrontendClass('my-custom-class');
106-
113+
// Save the attribute.
107114
$this->productAttributeRepository->save($attribute);
108115

116+
// Check that the frontend_class was updated correctly.
109117
try {
110118
$skuAttribute = $this->eavConfig->getAttribute('catalog_product', 'sku');
111-
$this->assertEquals('my-custom-class', $skuAttribute->getFrontendClass());
119+
$this->assertEquals($expectedFrontEndClass, $skuAttribute->getFrontendClass());
112120
} catch (LocalizedException $e) {
113121
$this->fail($e->getMessage());
114122
}

0 commit comments

Comments
 (0)