forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
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 magento#8611 from magento-l3/Tier4-PR-10-30-2023
Tier4 PR Delivery 10.30.23
- Loading branch information
Showing
24 changed files
with
576 additions
and
105 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
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
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
93 changes: 93 additions & 0 deletions
93
app/code/Magento/Customer/Test/Unit/Model/Address/CustomerAddressDataProviderTest.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,93 @@ | ||
<?php | ||
/** | ||
* Copyright 2023 Adobe | ||
* All Rights Reserved. | ||
* | ||
* NOTICE: All information contained herein is, and remains | ||
* the property of Adobe and its suppliers, if any. The intellectual | ||
* and technical concepts contained herein are proprietary to Adobe | ||
* and its suppliers and are protected by all applicable intellectual | ||
* property laws, including trade secret and copyright laws. | ||
* Dissemination of this information or reproduction of this material | ||
* is strictly forbidden unless prior written permission is obtained | ||
* from Adobe. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Customer\Test\Unit\Model\Address; | ||
|
||
use Magento\Customer\Api\Data\AddressInterface; | ||
use Magento\Customer\Api\Data\CustomerInterface; | ||
use Magento\Customer\Model\Address\CustomerAddressDataFormatter; | ||
use Magento\Customer\Model\Address\CustomerAddressDataProvider; | ||
use Magento\Customer\Model\Config\Share; | ||
use Magento\Directory\Model\AllowedCountries; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class CustomerAddressDataProviderTest extends TestCase | ||
{ | ||
/** | ||
* @var CustomerAddressDataFormatter|MockObject | ||
*/ | ||
private CustomerAddressDataFormatter $customerAddressDataFormatter; | ||
|
||
/** | ||
* @var Share|MockObject | ||
*/ | ||
private Share $shareConfig; | ||
|
||
/** | ||
* @var AllowedCountries|MockObject | ||
*/ | ||
private AllowedCountries $allowedCountryReader; | ||
|
||
/** | ||
* @var CustomerAddressDataProvider | ||
*/ | ||
private CustomerAddressDataProvider $provider; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
$this->customerAddressDataFormatter = $this->createMock(CustomerAddressDataFormatter::class); | ||
$this->shareConfig = $this->createMock(Share::class); | ||
$this->allowedCountryReader = $this->createMock(AllowedCountries::class); | ||
|
||
$this->provider = new CustomerAddressDataProvider( | ||
$this->customerAddressDataFormatter, | ||
$this->shareConfig, | ||
$this->allowedCountryReader | ||
); | ||
} | ||
|
||
/** | ||
* @return void | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
*/ | ||
public function testGetAddressDataByCustomer(): void | ||
{ | ||
$addressLimit = 1; | ||
$this->allowedCountryReader->expects($this->once())->method('getAllowedCountries')->willReturn(['1']); | ||
$this->customerAddressDataFormatter->expects($this->once()) | ||
->method('prepareAddress') | ||
->willreturn([1]); | ||
$this->shareConfig->expects($this->any())->method('isGlobalScope')->willReturn(false); | ||
|
||
$viableAddress = $this->getMockForAbstractClass(AddressInterface::class); | ||
$viableAddress->expects($this->once())->method('getId')->willReturn(1); | ||
$faultyAddress = $this->getMockForAbstractClass(AddressInterface::class); | ||
|
||
$customer = $this->getMockForAbstractClass(CustomerInterface::class); | ||
$customer->expects($this->once()) | ||
->method('getAddresses') | ||
->willReturn([$viableAddress, $faultyAddress]); | ||
|
||
$expectedResult = [ | ||
'1' => [1] | ||
]; | ||
$this->assertSame($expectedResult, $this->provider->getAddressDataByCustomer($customer, $addressLimit)); | ||
} | ||
} |
Oops, something went wrong.