File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed
app/code/Magento/Customer/Block/DataProviders
dev/tests/integration/testsuite/Magento/Customer Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public function getFrontendLabel(string $attributeCode): string
5252 {
5353 try {
5454 $ attribute = $ this ->addressMetadata ->getAttributeMetadata ($ attributeCode );
55- $ frontendLabel = $ attribute ->getFrontendLabel ();
55+ $ frontendLabel = $ attribute ->getStoreLabel () ?: $ attribute -> getFrontendLabel ();
5656 } catch (NoSuchEntityException $ e ) {
5757 $ frontendLabel = '' ;
5858 }
Original file line number Diff line number Diff line change @@ -138,6 +138,22 @@ public function testFaxEnabled(): void
138138 $ this ->assertStringContainsString ('title="Fax" ' , $ block ->toHtml ());
139139 }
140140
141+ /**
142+ * @magentoDataFixture Magento/Customer/_files/attribute_city_store_label_address.php
143+ */
144+ public function testCityWithStoreLabel (): void
145+ {
146+ /** @var \Magento\Customer\Block\Form\Register $block */
147+ $ block = Bootstrap::getObjectManager ()->create (
148+ Register::class
149+ )->setTemplate ('Magento_Customer::form/register.phtml ' )
150+ ->setShowAddressFields (true );
151+ $ this ->setAttributeDataProvider ($ block );
152+
153+ $ this ->assertStringNotContainsString ('title="City" ' , $ block ->toHtml ());
154+ $ this ->assertStringContainsString ('title="Suburb" ' , $ block ->toHtml ());
155+ }
156+
141157 /**
142158 * @inheritdoc
143159 */
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magento, Inc. All rights reserved.
4+ * See COPYING.txt for license details.
5+ */
6+ //@codingStandardsIgnoreFile
7+ /** @var \Magento\Customer\Model\Attribute $model */
8+ $ model = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (\Magento \Customer \Model \Attribute::class);
9+ /** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
10+ $ storeManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (\Magento \Store \Model \StoreManager::class);
11+ $ model ->loadByCode ('customer_address ' , 'city ' );
12+ $ storeLabels = $ model ->getStoreLabels ();
13+ $ stores = $ storeManager ->getStores ();
14+ /** @var \Magento\Store\Api\Data\WebsiteInterface $website */
15+ foreach ($ stores as $ store ) {
16+ $ storeLabels [$ store ->getId ()] = 'Suburb ' ;
17+ }
18+ $ model ->setStoreLabels ($ storeLabels );
19+ $ model ->save ();
You can’t perform that action at this time.
0 commit comments