Skip to content

Commit 97cf0a6

Browse files
committed
MC-16108: EAV attribute is not cached
- Update integration tests;
1 parent d98f06b commit 97cf0a6

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

dev/tests/integration/testsuite/Magento/Eav/_files/attribute_for_caching.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414

1515
/** @var \Magento\Eav\Model\Entity\Attribute\Set $attributeSet */
1616
$attributeSet = $objectManager->create(\Magento\Eav\Model\Entity\Attribute\Set::class);
17-
$attributeSet->setData([
18-
'attribute_set_name' => 'test_attribute_set',
19-
'entity_type_id' => $entityTypeId,
20-
'sort_order' => 100,
21-
]);
17+
$attributeSet->setData(
18+
[
19+
'attribute_set_name' => 'test_attribute_set',
20+
'entity_type_id' => $entityTypeId,
21+
'sort_order' => 100
22+
]
23+
);
2224
$attributeSet->validate();
2325
$attributeSet->save();
2426

dev/tests/integration/testsuite/Magento/Eav/_files/attribute_for_caching_rollback.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,29 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
76

8-
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */
9-
$attribute = $objectManager->create(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class);
7+
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
8+
use Magento\Eav\Model\Entity\Attribute\Set;
9+
use Magento\TestFramework\Helper\Bootstrap;
10+
use Magento\Framework\Registry;
11+
12+
$objectManager = Bootstrap::getObjectManager();
13+
$registry = $objectManager->get(Registry::class);
14+
$registry->unregister('isSecureArea');
15+
$registry->register('isSecureArea', true);
16+
17+
/** @var Attribute $attribute */
18+
$attribute = $objectManager->create(Attribute::class);
1019
$attribute->loadByCode(4, 'foo');
1120

1221
if ($attribute->getId()) {
1322
$attribute->delete();
1423
}
1524

16-
/** @var \Magento\Eav\Model\Entity\Attribute\Set $attributeSet */
17-
$attributeSet = $objectManager->create(\Magento\Eav\Model\Entity\Attribute\Set::class)
18-
->load('test_attribute_set', 'attribute_set_name');
25+
/** @var Set $attributeSet */
26+
$attributeSet = $objectManager->create(Set::class)->load('test_attribute_set', 'attribute_set_name');
1927
if ($attributeSet->getId()) {
2028
$attributeSet->delete();
2129
}
30+
$registry->unregister('isSecureArea');
31+
$registry->register('isSecureArea', false);

0 commit comments

Comments
 (0)