-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5302 from magento-tsg-csl3/2.4-develop-pr12
[TSG-CSL3] For 2.4 (pr3)
- Loading branch information
Showing
6 changed files
with
111 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
dev/tests/integration/testsuite/Magento/Customer/Model/CustomerAddressAttributeTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Customer\Model; | ||
|
||
use Magento\Customer\Model\Metadata\AddressMetadata; | ||
use Magento\Eav\Model\Config; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
class CustomerAddressAttributeTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var Config | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* @var StoreManagerInterface | ||
*/ | ||
private $storeManager; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function setUp() | ||
{ | ||
$objectManager = Bootstrap::getObjectManager(); | ||
$this->config = $objectManager->get(Config::class); | ||
$this->storeManager = $objectManager->get(StoreManagerInterface::class); | ||
} | ||
|
||
/** | ||
* Tests cached scope_is_required attribute value for a certain website | ||
* | ||
* @return void | ||
* @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php | ||
*/ | ||
public function testGetScopeIsRequiredAttributeValueFromCache(): void | ||
{ | ||
$attributeCode = 'telephone'; | ||
$entityType = AddressMetadata::ENTITY_TYPE_ADDRESS; | ||
$attribute = $this->config->getAttribute($entityType, $attributeCode); | ||
$currentStore = $this->storeManager->getStore(); | ||
$secondWebsite = $this->storeManager->getWebsite('test'); | ||
$attribute->setWebsite($secondWebsite->getId()); | ||
$attribute->setData('scope_is_required', '0'); | ||
$attribute->save(); | ||
$this->config->getAttribute($entityType, $attributeCode); | ||
$this->storeManager->setCurrentStore('fixture_second_store'); | ||
try { | ||
$this->config->getEntityAttributes($attribute->getEntityTypeId(), $attribute); | ||
$scopeAttribute = $this->config->getAttribute($entityType, $attributeCode); | ||
$this->assertEquals(0, $scopeAttribute->getIsRequired()); | ||
} finally { | ||
$this->storeManager->setCurrentStore($currentStore); | ||
} | ||
} | ||
} |