-
Notifications
You must be signed in to change notification settings - Fork 47
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 #8844 from adobe-commerce-tier-4/Tier4-Kings-PR-03…
…-19-2024 [Support Tier-4-Kings glo16746] 03.19.2024 Regular delivery of bugfixes and improvements
- Loading branch information
Showing
6 changed files
with
278 additions
and
33 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
110 changes: 110 additions & 0 deletions
110
dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/Order/AddressTest.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,110 @@ | ||
<?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\Sales\Model\ResourceModel\Order; | ||
|
||
use Magento\Catalog\Test\Fixture\Product as ProductFixture; | ||
use Magento\Checkout\Test\Fixture\PlaceOrder as PlaceOrderFixture; | ||
use Magento\Checkout\Test\Fixture\SetBillingAddress; | ||
use Magento\Checkout\Test\Fixture\SetDeliveryMethod as SetDeliveryMethodFixture; | ||
use Magento\Checkout\Test\Fixture\SetPaymentMethod as SetPaymentMethodFixture; | ||
use Magento\Checkout\Test\Fixture\SetShippingAddress; | ||
use Magento\Customer\Test\Fixture\Customer; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Quote\Test\Fixture\AddProductToCart; | ||
use Magento\Quote\Test\Fixture\CustomerCart; | ||
use Magento\Sales\Api\OrderAddressRepositoryInterface; | ||
use Magento\Sales\Api\OrderRepositoryInterface; | ||
use Magento\TestFramework\Fixture\DataFixture; | ||
use Magento\TestFramework\Fixture\DataFixtureStorage; | ||
use Magento\TestFramework\Fixture\DataFixtureStorageManager; | ||
use Magento\TestFramework\Fixture\DbIsolation; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
use Magento\TestFramework\ObjectManager; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Test for order address | ||
* | ||
* @magentoAppArea adminhtml | ||
*/ | ||
class AddressTest extends TestCase | ||
{ | ||
/** | ||
* @var ObjectManager | ||
*/ | ||
private $objectManager; | ||
|
||
/** | ||
* @var DataFixtureStorage | ||
*/ | ||
private $fixtures; | ||
|
||
/** | ||
* @var OrderAddressRepositoryInterface | ||
*/ | ||
private $orderAddressRepository; | ||
|
||
/** | ||
* @var OrderRepositoryInterface | ||
*/ | ||
private $orderRepository; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->objectManager = Bootstrap::getObjectManager(); | ||
$this->fixtures = $this->objectManager->get(DataFixtureStorageManager::class)->getStorage(); | ||
$this->orderAddressRepository = $this->objectManager->get(OrderAddressRepositoryInterface::class); | ||
$this->orderRepository = $this->objectManager->get(OrderRepositoryInterface::class); | ||
} | ||
|
||
/** | ||
* Check to see if leading zeros have been added to the number strings | ||
* in the order address's phone field. | ||
* | ||
* @return void | ||
* @throws LocalizedException | ||
*/ | ||
#[ | ||
DataFixture(ProductFixture::class, as: 'product'), | ||
DataFixture(Customer::class, as: 'customer'), | ||
DataFixture(CustomerCart::class, ['customer_id' => '$customer.id$'], as: 'quote'), | ||
DataFixture(AddProductToCart::class, ['cart_id' => '$quote.id$', 'product_id' => '$product.id$', 'qty' => 1]), | ||
DataFixture(SetBillingAddress::class, [ | ||
'cart_id' => '$quote.id$', | ||
'address' => [ | ||
'customer_id' => '$customer.id$', | ||
'telephone' => '009999999999' | ||
] | ||
]), | ||
DataFixture(SetShippingAddress::class, ['cart_id' => '$quote.id$']), | ||
DataFixture(SetDeliveryMethodFixture::class, ['cart_id' => '$quote.id$']), | ||
DataFixture(SetPaymentMethodFixture::class, ['cart_id' => '$quote.id$']), | ||
DataFixture(PlaceOrderFixture::class, ['cart_id' => '$quote.id$'], 'order') | ||
] | ||
public function testOrderAddressUpdateWithTelephone(): void | ||
{ | ||
$telephoneValue = '9999999999'; | ||
$order = $this->fixtures->get('order'); | ||
$address = $this->orderAddressRepository->get($order->getBillingAddressId()); | ||
$address->setTelephone($telephoneValue); | ||
$this->orderAddressRepository->save($address); | ||
$updatedOrder = $this->orderRepository->get($order->getId()); | ||
$billingAddress = $updatedOrder->getBillingAddress(); | ||
$updatedTelephoneValue = $billingAddress->getTelephone(); | ||
$this->assertEquals($telephoneValue, $updatedTelephoneValue); | ||
} | ||
} |
Oops, something went wrong.