Skip to content

Commit 0caf3d6

Browse files
ACP2E-391 Fix WYSIWYG editor is not showing for product attributes
1 parent 72239c5 commit 0caf3d6

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ public function testIndexAction()
196196

197197
/**
198198
* Testing existing product edit page.
199-
*
200199
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
201200
*/
202201
public function testEditAction()
@@ -233,6 +232,22 @@ public function testEditAction()
233232
),
234233
'"Save & Duplicate" button isn\'t present on Edit Product page'
235234
);
235+
$this->assertStringContainsString('toggleproduct_form_short_description', $body);
236+
}
237+
238+
/**
239+
* Testing product short description has Wysiwyg after creating category short_description attribute.
240+
* @magentoDataFixture Magento/Catalog/_files/category_custom_short_description_attribute.php
241+
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
242+
*/
243+
public function testProductShorDescriptionHasWysiwygEditor()
244+
{
245+
/** @var ProductRepository $repository */
246+
$repository = $this->repositoryFactory->create();
247+
$product = $repository->get('simple');
248+
$this->dispatch('backend/catalog/product/edit/id/' . $product->getEntityId());
249+
$body = $this->getResponse()->getBody();
250+
$this->assertStringContainsString('toggleproduct_form_short_description', $body);
236251
}
237252

238253
/**
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/** @var Attribute $attribute */
8+
9+
use Magento\Catalog\Model\Category\AttributeFactory;
10+
use Magento\Catalog\Model\Category\Attribute;
11+
use Magento\TestFramework\Helper\Bootstrap;
12+
13+
$attributeFactory = Bootstrap::getObjectManager()->get(AttributeFactory::class);
14+
$attribute = $attributeFactory->create();
15+
$attribute->setAttributeCode('short_description')
16+
->setEntityTypeId(3)
17+
->setBackendType('text')
18+
->setFrontendInput('textarea')
19+
->setIsGlobal(1)
20+
->setIsUserDefined(1);
21+
$attribute->save();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/** @var Registry $registry */
8+
9+
use Magento\Catalog\Model\Category\AttributeFactory;
10+
use Magento\Framework\Registry;
11+
use Magento\TestFramework\Helper\Bootstrap;
12+
13+
$objectManager = Bootstrap::getObjectManager();
14+
/** @var Registry $registry */
15+
$registry = $objectManager->get(Registry::class);
16+
17+
$registry->unregister('isSecureArea');
18+
$registry->register('isSecureArea', true);
19+
20+
/** @var AttributeFactory $attributeFactory */
21+
$attributeFactory = $objectManager->get(AttributeFactory::class);
22+
$attribute = $attributeFactory->create();
23+
24+
$attribute->loadByCode(3, 'short_description');
25+
26+
if ($attribute->getId()) {
27+
$attribute->delete();
28+
}
29+
30+
$registry->unregister('isSecureArea');
31+
$registry->register('isSecureArea', false);

0 commit comments

Comments
 (0)