Skip to content

Commit 7d86388

Browse files
committed
#27338: Test API functional for Extension Attribute of Shipping Addresses
1 parent 013bbc9 commit 7d86388

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestShipmentEstimationWithExtensionAttributesTest.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Quote\Api;
77

8+
use Magento\Framework\Api\ExtensibleDataInterface;
89
use Magento\TestFramework\ObjectManager;
910
use Magento\TestFramework\TestCase\WebapiAbstract;
1011
use Magento\Quote\Api\Data\AddressInterface;
@@ -26,6 +27,8 @@ protected function setUp()
2627
}
2728

2829
/**
30+
* @magentoAppIsolation enabled
31+
* @magentoDbIsolation disabled
2932
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_free_shipping.php
3033
* @magentoApiDataFixture Magento/Sales/_files/quote.php
3134
*/
@@ -59,7 +62,7 @@ public function testEstimateByExtendedAddress()
5962
];
6063
if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) {
6164
/** @var \Magento\Quote\Model\Quote\Address $address */
62-
$address = $quote->getBillingAddress();
65+
$address = $quote->getShippingAddress();
6366

6467
$data = [
6568
AddressInterface::KEY_ID => (int)$address->getId(),
@@ -79,9 +82,8 @@ public function testEstimateByExtendedAddress()
7982
AddressInterface::SAME_AS_BILLING => $address->getSameAsBilling(),
8083
AddressInterface::CUSTOMER_ADDRESS_ID => $address->getCustomerAddressId(),
8184
AddressInterface::SAVE_IN_ADDRESS_BOOK => $address->getSaveInAddressBook(),
82-
83-
'extension_attributes' => [
84-
'test_attribute' => 1
85+
ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY => [
86+
'discounts' => []
8587
]
8688
];
8789

@@ -90,19 +92,24 @@ public function testEstimateByExtendedAddress()
9092
'address' => $data
9193
];
9294
} else {
95+
9396
$requestData = [
9497
'address' => [
9598
'country_id' => "US",
9699
'postcode' => null,
97100
'region' => null,
98-
'region_id' => null
99-
],
101+
'region_id' => null,
102+
'extension_attributes' => [
103+
'discounts' => []
104+
]
105+
]
100106
];
101107
}
102108
// Cart must be anonymous (see fixture)
103109
$this->assertEmpty($quote->getCustomerId());
104110

105111
$result = $this->_webApiCall($serviceInfo, $requestData);
112+
106113
$this->assertNotEmpty($result);
107114
$this->assertEquals(1, count($result));
108115
foreach ($result as $rate) {

0 commit comments

Comments
 (0)