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
Quote
Fixtures
quote_sec_website.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\Catalog\Api\Data\ProductInterface
;
9
use
Magento\Customer\Api\Data\CustomerInterface
;
10
use
Magento\Quote\Api\CartRepositoryInterface
;
11
use
Magento\Quote\Model\Quote
;
12
use
Magento\Quote\Model\Quote\Address
;
13
use
Magento\Store\Api\Data\StoreInterface
;
14
use
Magento\TestFramework\Helper\Bootstrap
;
15
use
Magento\TestFramework\ObjectManager
;
16
22
require
__DIR__
.
'/../../Customer/Fixtures/customer_sec_website.php'
;
23
require
__DIR__
.
'/simple_product.php'
;
24
26
$objectManager
= Bootstrap::getObjectManager();
27
28
$addressData
= include
__DIR__
.
'/../../Customer/Fixtures/address_data.php'
;
30
$shippingAddress
=
$objectManager
->create(Address::class, [
'data'
=>
$addressData
[0]]);
31
$shippingAddress
->setAddressType(
'shipping'
);
32
33
$billingAddress
= clone
$shippingAddress
;
34
$billingAddress
->setId(
null
)
35
->setAddressType(
'billing'
);
36
38
$quote
=
$objectManager
->create(
39
Quote::class,
40
[
41
'data'
=> [
42
'customer_id'
=>
$customer
->getId(),
43
'store_id'
=>
$store
->getId(),
44
'reserved_order_id'
=>
'0000032134'
,
45
'is_active'
=>
true
,
46
'is_multishipping'
=>
false
47
]
48
]
49
);
50
$quote
->setShippingAddress(
$shippingAddress
)
51
->setBillingAddress(
$billingAddress
)
52
->addProduct(
$product
);
53
54
$quote
->getPayment()
55
->setMethod(
'checkmo'
);
56
$quote
->getShippingAddress()
57
->setShippingMethod(
'flatrate_flatrate'
)
58
->setCollectShippingRates(
true
);
59
$quote
->collectTotals();
60
62
$repository
=
$objectManager
->get(CartRepositoryInterface::class);
63
$repository
->save(
$quote
);
$objectManager
$objectManager
Definition:
quote_sec_website.php:26
$customer
$customer
Definition:
customers.php:11
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
false
return false
Definition:
gallery.phtml:36
$addressData
$addressData
Definition:
quote_sec_website.php:28
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$repository
$repository
Definition:
quote_sec_website.php:62
Magento\Quote\Model\Quote\Address
Definition:
BillingAddressPersister.php:6
Magento\Quote\Api\CartRepositoryInterface
Definition:
CartRepositoryInterface.php:13
$shippingAddress
$shippingAddress
Definition:
quote_sec_website.php:30
$billingAddress
$billingAddress
Definition:
quote_sec_website.php:33
Magento\Quote\Model\Quote
Definition:
AddressTest.php:6
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Customer\Api\Data\CustomerInterface
Definition:
CustomerInterface.php:13
$store
$store
Definition:
payment_configuration_rollback.php:33
Magento\Store\Api\Data\StoreInterface
Definition:
StoreInterface.php:14
$quote
$quote
Definition:
quote_sec_website.php:38
Magento\Catalog\Api\Data\ProductInterface
Definition:
ProductInterface.php:14
Magento\TestFramework\ObjectManager
Definition:
Config.php:6