Skip to content

Commit d3e5e51

Browse files
committed
ACP2E-978: "Text field" product attributes not visible in page builder conditions.
- add test
1 parent 008205b commit d3e5e51

File tree

1 file changed

+25
-0
lines changed
  • dev/tests/integration/testsuite/Magento/CatalogWidget/Model/Rule/Condition

1 file changed

+25
-0
lines changed

dev/tests/integration/testsuite/Magento/CatalogWidget/Model/Rule/Condition/ProductTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\CatalogWidget\Model\Rule\Condition;
88

99
use Magento\Catalog\Api\Data\ProductInterface;
10+
use Magento\Catalog\Model\ResourceModel\Product as ProductResource;
1011

1112
class ProductTest extends \PHPUnit\Framework\TestCase
1213
{
@@ -50,6 +51,30 @@ public function testLoadAttributeOptions()
5051
}
5152
}
5253

54+
/**
55+
* @return void
56+
*/
57+
public function testLoadAttributeOptionsContainsTextAttributes()
58+
{
59+
$this->conditionProduct->loadAttributeOptions();
60+
$options = $this->conditionProduct->getAttributeOption();
61+
62+
/** @var ProductResource $productResource */
63+
$productResource = $this->objectManager->create(ProductResource::class);
64+
$attributes = $productResource->loadAllAttributes()->getAttributesByCode();
65+
foreach ($attributes as $key => $attribute) {
66+
if (!$attribute->getFrontendLabel() || $attribute->getFrontendInput() !== 'text') {
67+
unset($attributes[$key]);
68+
}
69+
}
70+
71+
$textAttributeCodes = array_keys($attributes);
72+
foreach ($textAttributeCodes as $textAttributeCode) {
73+
$this->assertArrayHasKey($textAttributeCode, $options);
74+
$this->assertNotEmpty($options[$textAttributeCode]);
75+
}
76+
}
77+
5378
/**
5479
* @return void
5580
*/

0 commit comments

Comments
 (0)