Skip to content

Commit 33f29e0

Browse files
committed
MC-40832: Create automated test for: "Verify that customer attribute label is displayed according saved values for each store view"
1 parent 81ab4fb commit 33f29e0

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

dev/tests/integration/testsuite/Magento/Customer/Block/Address/EditTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
/**
2323
* Tests Address Edit Block
2424
*
25+
* @see \Magento\Customer\Block\Address\Edit
26+
*
2527
* @magentoAppArea frontend
2628
* @magentoAppIsolation enabled
2729
*
@@ -190,14 +192,13 @@ public function testVatIdFieldNotVisible(): void
190192
*/
191193
public function testCheckPostCodeLabels(): void
192194
{
193-
$newLabel = 'default store postcode label';
194195
$html = $this->executeInStoreContext->execute('default', [$this->block, 'toHtml']);
195196
$this->assertEquals(
196197
1,
197198
Xpath::getElementsCountForXpath(
198199
sprintf(
199200
"//form[contains(@class, 'form-address-edit')]//label[@for='zip']/span[contains(text(), '%s')]",
200-
$newLabel
201+
'default store postcode label'
201202
),
202203
$html
203204
)

dev/tests/integration/testsuite/Magento/Customer/_files/attribute_postcode_store_label_address_rollback.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,23 @@
88
use Magento\Customer\Api\AddressMetadataInterface;
99
use Magento\Customer\Api\Data\AddressInterface;
1010
use Magento\Eav\Api\AttributeRepositoryInterface;
11+
use Magento\Framework\Registry;
1112
use Magento\Store\Model\StoreManagerInterface;
1213
use Magento\TestFramework\Helper\Bootstrap;
1314

1415
$objectManager = Bootstrap::getObjectManager();
16+
$registry = $objectManager->get(Registry::class);
1517
/** @var AttributeRepositoryInterface $attributeRepository */
1618
$attributeRepository = $objectManager->get(AttributeRepositoryInterface::class);
1719
/** @var StoreManagerInterface $storeManager */
1820
$storeManager = $objectManager->get(StoreManagerInterface::class);
21+
22+
$registry->unregister('isSecureArea');
23+
$registry->register('isSecureArea', true);
24+
1925
$attribute = $attributeRepository->get(AddressMetadataInterface::ENTITY_TYPE_ADDRESS, AddressInterface::POSTCODE);
2026
$attribute->setStoreLabels([]);
2127
$attributeRepository->save($attribute);
28+
29+
$registry->unregister('isSecureArea');
30+
$registry->register('isSecureArea', false);

0 commit comments

Comments
 (0)