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
Paypal
_files
quote_with_fpt.php
Go to the documentation of this file.
1
<?php
6
use
Magento\Catalog\Api\Data\ProductInterface
;
7
use
Magento\Catalog\Api\ProductRepositoryInterface
;
8
use
Magento\Framework\ObjectManagerInterface
;
9
use
Magento\Quote\Model\Quote
;
10
use
Magento\Quote\Model\Quote\Address
;
11
use
Magento\Quote\Model\QuoteRepository
;
12
use
Magento\TestFramework\Helper\Bootstrap
;
13
14
require
__DIR__
.
'/../../Weee/_files/product_with_fpt.php'
;
15
17
$objectManager
= Bootstrap::getObjectManager();
18
19
$addressData
= [
20
'firstname'
=>
'John'
,
21
'lastname'
=>
'Doe'
,
22
'company'
=>
''
,
23
'email'
=>
'
[email protected]
'
,
24
'street'
=> [
25
0 =>
'test1'
,
26
],
27
'city'
=>
'Test'
,
28
'region_id'
=>
'1'
,
29
'region'
=>
''
,
30
'postcode'
=>
'9001'
,
31
'country_id'
=>
'US'
,
32
'telephone'
=>
'11111111'
,
33
];
35
$billingAddress
=
$objectManager
->create(Address::class, [
'data'
=>
$addressData
]);
36
$billingAddress
->setAddressType(
'billing'
);
37
38
$shippingAddress
= clone
$billingAddress
;
39
$shippingAddress
->setAddressType(
'shipping'
)
40
->setId(
null
);
41
43
$quote
=
$objectManager
->create(Quote::class);
44
$quote
->setCustomerIsGuest(
true
)
45
->setReservedOrderId(
'100000016'
)
46
->setBillingAddress(
$billingAddress
)
47
->setShippingAddress(
$shippingAddress
);
48
49
$quote
->addProduct(
$product
, 1);
50
$quote
->collectTotals();
51
53
$quoteRepository
=
$objectManager
->get(QuoteRepository::class);
54
$quoteRepository
->save(
$quote
);
$quote
$quote
Definition:
quote_with_fpt.php:43
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
$billingAddress
$billingAddress
Definition:
quote_with_fpt.php:35
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
$objectManager
$objectManager
Definition:
quote_with_fpt.php:17
Magento\Quote\Model\QuoteRepository
Definition:
LoadHandler.php:6
Magento\Catalog\Api\ProductRepositoryInterface
Definition:
ProductRepositoryInterface.php:14
Magento\Quote\Model\Quote\Address
Definition:
BillingAddressPersister.php:6
$addressData
$addressData
Definition:
quote_with_fpt.php:19
$shippingAddress
$shippingAddress
Definition:
quote_with_fpt.php:38
$quoteRepository
$quoteRepository
Definition:
quote_with_fpt.php:53
Magento\Quote\Model\Quote
Definition:
AddressTest.php:6
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Catalog\Api\Data\ProductInterface
Definition:
ProductInterface.php:14