Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Multishipping
Fixtures
shipping_address_list.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\TestFramework\Helper\Bootstrap
;
9
use
Magento\TestFramework\ObjectManager
;
10
use
Magento\Quote\Api\Data\AddressInterface
;
11
use
Magento\Quote\Model\Quote\Address\Rate
;
12
17
if
(empty(
$quote
)) {
18
throw
new \Exception(
'$quote should be defined in the parent fixture'
);
19
}
20
21
$addressList
= [
22
[
23
'firstname'
=>
'Jonh'
,
24
'lastname'
=>
'Doe'
,
25
'telephone'
=>
'0333-233-221'
,
26
'street'
=> [
'Main Division 1'
],
27
'city'
=>
'Culver City'
,
28
'region'
=>
'CA'
,
29
'postcode'
=> 90800,
30
'country_id'
=>
'US'
,
31
'email'
=>
'
[email protected]
'
,
32
'address_type'
=>
'shipping'
,
33
],
34
[
35
'firstname'
=>
'Antoni'
,
36
'lastname'
=>
'Holmes'
,
37
'telephone'
=>
'0333-233-221'
,
38
'street'
=> [
'Second Division 2'
],
39
'city'
=>
'Denver'
,
40
'region'
=>
'CO'
,
41
'postcode'
=> 80203,
42
'country_id'
=>
'US'
,
43
'email'
=>
'
[email protected]
'
,
44
'address_type'
=>
'shipping'
45
]
46
];
47
49
$objectManager
= Bootstrap::getObjectManager();
50
51
$methodCode
=
'flatrate_flatrate'
;
52
foreach
(
$addressList
as
$data
) {
54
$rate
=
$objectManager
->create(Rate::class);
55
$rate
->setCode(
$methodCode
)
56
->setPrice(5.00);
57
58
$address
=
$objectManager
->create(AddressInterface::class, [
'data'
=>
$data
]);
59
$address
->setShippingMethod(
$methodCode
)
60
->addShippingRate(
$rate
)
61
->setShippingAmount(5.00)
62
->setBaseShippingAmount(5.00);
63
64
$quote
->addAddress(
$address
);
65
}
66
$quote
->setIsMultiShipping(1);
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
Magento\Quote\Api\Data\AddressInterface
Definition:
AddressInterface.php:13
$quote
$quote
Definition:
paypal_quote.php:17
Magento\Quote\Model\Quote\Address\Rate
Definition:
Rate.php:38
$address
$address
Definition:
customer.php:38
$rate
$rate
Definition:
quote_with_check_payment.php:11
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
$objectManager
$objectManager
Definition:
shipping_address_list.php:49
$methodCode
$methodCode
Definition:
shipping_address_list.php:51
$addressList
if(empty($quote)) $addressList
Definition:
shipping_address_list.php:21
Magento\TestFramework\ObjectManager
Definition:
Config.php:6