|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the Spryker Commerce OS. |
|
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
declare(strict_types = 1); |
|
9
|
|
|
|
|
10
|
|
|
namespace PyzTest\Glue\Checkout\RestApi\Fixtures; |
|
11
|
|
|
|
|
12
|
|
|
use Generated\Shared\Transfer\CustomerTransfer; |
|
13
|
|
|
use Generated\Shared\Transfer\QuoteTransfer; |
|
14
|
|
|
use Generated\Shared\Transfer\ShipmentMethodTransfer; |
|
15
|
|
|
use PyzTest\Glue\Checkout\CheckoutApiTester; |
|
16
|
|
|
use SprykerTest\Shared\Shipment\Helper\ShipmentMethodDataHelper; |
|
17
|
|
|
use SprykerTest\Shared\Testify\Fixtures\FixturesBuilderInterface; |
|
18
|
|
|
use SprykerTest\Shared\Testify\Fixtures\FixturesContainerInterface; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Auto-generated group annotations |
|
22
|
|
|
* |
|
23
|
|
|
* @group PyzTest |
|
24
|
|
|
* @group Glue |
|
25
|
|
|
* @group Checkout |
|
26
|
|
|
* @group RestApi |
|
27
|
|
|
* @group CheckoutDataShipmentRelationshipsFixtures |
|
28
|
|
|
* Add your own group annotations below this line |
|
29
|
|
|
* @group EndToEnd |
|
30
|
|
|
*/ |
|
31
|
|
|
class CheckoutDataShipmentRelationshipsFixtures implements FixturesBuilderInterface, FixturesContainerInterface |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* @var string |
|
35
|
|
|
*/ |
|
36
|
|
|
protected const TEST_USERNAME = 'CheckoutDataRelationshipsFixtures'; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var string |
|
40
|
|
|
*/ |
|
41
|
|
|
protected const TEST_PASSWORD = 'change123'; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var \Generated\Shared\Transfer\CustomerTransfer |
|
45
|
|
|
*/ |
|
46
|
|
|
protected CustomerTransfer $customerTransfer; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var \Generated\Shared\Transfer\QuoteTransfer |
|
50
|
|
|
*/ |
|
51
|
|
|
protected QuoteTransfer $quoteTransfer; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var \Generated\Shared\Transfer\ShipmentMethodTransfer |
|
55
|
|
|
*/ |
|
56
|
|
|
protected ShipmentMethodTransfer $shipmentMethodTransfer; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @return \Generated\Shared\Transfer\QuoteTransfer |
|
60
|
|
|
*/ |
|
61
|
|
|
public function getQuoteTransfer(): QuoteTransfer |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->quoteTransfer; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return \Generated\Shared\Transfer\CustomerTransfer |
|
68
|
|
|
*/ |
|
69
|
|
|
public function getCustomerTransfer(): CustomerTransfer |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->customerTransfer; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @return \Generated\Shared\Transfer\ShipmentMethodTransfer |
|
76
|
|
|
*/ |
|
77
|
|
|
public function getShipmentMethodTransfer(): ShipmentMethodTransfer |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->shipmentMethodTransfer; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @param \PyzTest\Glue\Checkout\CheckoutApiTester $I |
|
84
|
|
|
* |
|
85
|
|
|
* @return \SprykerTest\Shared\Testify\Fixtures\FixturesContainerInterface |
|
86
|
|
|
*/ |
|
87
|
|
|
public function buildFixtures(CheckoutApiTester $I): FixturesContainerInterface |
|
88
|
|
|
{ |
|
89
|
|
|
$I->truncateSalesOrderThresholds(); |
|
90
|
|
|
|
|
91
|
|
|
$customerTransfer = $I->haveCustomer([ |
|
92
|
|
|
CustomerTransfer::USERNAME => static::TEST_USERNAME, |
|
93
|
|
|
CustomerTransfer::PASSWORD => static::TEST_PASSWORD, |
|
94
|
|
|
CustomerTransfer::NEW_PASSWORD => static::TEST_PASSWORD, |
|
95
|
|
|
]); |
|
96
|
|
|
|
|
97
|
|
|
$this->customerTransfer = $I->confirmCustomer($customerTransfer); |
|
98
|
|
|
|
|
99
|
|
|
$this->shipmentMethodTransfer = $I->haveShipmentMethod( |
|
100
|
|
|
[ |
|
101
|
|
|
ShipmentMethodTransfer::CARRIER_NAME => 'Spryker Dummy Shipment with Shipment Type', |
|
102
|
|
|
ShipmentMethodTransfer::NAME => 'Standard with Shipment Type', |
|
103
|
|
|
], |
|
104
|
|
|
[], |
|
105
|
|
|
ShipmentMethodDataHelper::DEFAULT_PRICE_LIST, |
|
106
|
|
|
[ |
|
107
|
|
|
$I->getStoreFacade()->getCurrentStore()->getIdStore(), |
|
108
|
|
|
], |
|
109
|
|
|
); |
|
110
|
|
|
|
|
111
|
|
|
$this->quoteTransfer = $I->havePersistentQuoteWithItemsAndItemLevelShipment( |
|
112
|
|
|
$this->customerTransfer, |
|
113
|
|
|
[$I->getQuoteItemOverrideData($I->haveProductWithStock(), $this->shipmentMethodTransfer, 10)], |
|
114
|
|
|
); |
|
115
|
|
|
|
|
116
|
|
|
return $this; |
|
117
|
|
|
} |
|
118
|
|
|
} |
|
119
|
|
|
|