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\CompanyBusinessUnitTransfer; |
|
|
|
|
13
|
|
|
use Generated\Shared\Transfer\CompanyTransfer; |
|
|
|
|
14
|
|
|
use Generated\Shared\Transfer\CompanyUnitAddressCollectionTransfer; |
|
|
|
|
15
|
|
|
use Generated\Shared\Transfer\CompanyUnitAddressTransfer; |
|
|
|
|
16
|
|
|
use Generated\Shared\Transfer\CompanyUserTransfer; |
|
|
|
|
17
|
|
|
use Generated\Shared\Transfer\CustomerTransfer; |
|
|
|
|
18
|
|
|
use Generated\Shared\Transfer\QuoteTransfer; |
|
|
|
|
19
|
|
|
use Generated\Shared\Transfer\ShipmentMethodTransfer; |
|
|
|
|
20
|
|
|
use PyzTest\Glue\Checkout\CheckoutApiTester; |
21
|
|
|
use Spryker\Zed\Company\CompanyDependencyProvider; |
22
|
|
|
use SprykerTest\Shared\Shipment\Helper\ShipmentMethodDataHelper; |
23
|
|
|
use SprykerTest\Shared\Testify\Fixtures\FixturesBuilderInterface; |
24
|
|
|
use SprykerTest\Shared\Testify\Fixtures\FixturesContainerInterface; |
25
|
|
|
|
26
|
|
|
class CompanyBusinessUnitAddressCheckoutDataRestApiFixtures implements FixturesBuilderInterface, FixturesContainerInterface |
27
|
|
|
{ |
28
|
|
|
protected const TEST_USERNAME = 'CompanyBUAddressCheckoutDataRestApiFixtures'; |
29
|
|
|
|
30
|
|
|
protected const TEST_PASSWORD = 'change123'; |
31
|
|
|
|
32
|
|
|
protected CustomerTransfer $customerTransfer; |
33
|
|
|
|
34
|
|
|
protected QuoteTransfer $quoteTransfer; |
35
|
|
|
|
36
|
|
|
protected CompanyUserTransfer $companyUserTransfer; |
37
|
|
|
|
38
|
|
|
protected CompanyUnitAddressTransfer $companyUnitAddressTransfer; |
39
|
|
|
|
40
|
|
|
public function getQuoteTransfer(): QuoteTransfer |
41
|
|
|
{ |
42
|
|
|
return $this->quoteTransfer; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function getCustomerTransfer(): CustomerTransfer |
46
|
|
|
{ |
47
|
|
|
return $this->customerTransfer; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function getCompanyUserTransfer(): CompanyUserTransfer |
51
|
|
|
{ |
52
|
|
|
return $this->companyUserTransfer; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function getCompanyUnitAddressTransfer(): CompanyUnitAddressTransfer |
56
|
|
|
{ |
57
|
|
|
return $this->companyUnitAddressTransfer; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function buildFixtures(CheckoutApiTester $I): FixturesContainerInterface |
61
|
|
|
{ |
62
|
|
|
$I->truncateSalesOrderThresholds(); |
63
|
|
|
|
64
|
|
|
$customerTransfer = $I->haveCustomer([ |
65
|
|
|
CustomerTransfer::USERNAME => static::TEST_USERNAME, |
66
|
|
|
CustomerTransfer::PASSWORD => static::TEST_PASSWORD, |
67
|
|
|
CustomerTransfer::NEW_PASSWORD => static::TEST_PASSWORD, |
68
|
|
|
]); |
69
|
|
|
|
70
|
|
|
$this->customerTransfer = $I->confirmCustomer($customerTransfer); |
71
|
|
|
$this->buildCompanyUserAccount($I, $this->customerTransfer); |
72
|
|
|
|
73
|
|
|
$this->quoteTransfer = $this->createPersistentQuoteWithItemsAndItemLevelShipment($I); |
74
|
|
|
|
75
|
|
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
protected function buildCompanyUserAccount( |
79
|
|
|
CheckoutApiTester $I, |
80
|
|
|
CustomerTransfer $customerTransfer, |
81
|
|
|
): void { |
82
|
|
|
$this->mockCompanyPostSavePlugins($I); |
83
|
|
|
|
84
|
|
|
$companyTransfer = $I->haveActiveCompany([ |
85
|
|
|
CompanyTransfer::STATUS => 'approved', |
86
|
|
|
]); |
87
|
|
|
|
88
|
|
|
$this->companyUnitAddressTransfer = $I->haveCompanyUnitAddress([ |
89
|
|
|
CompanyUnitAddressTransfer::FK_COMPANY => $companyTransfer->getIdCompany(), |
90
|
|
|
]); |
91
|
|
|
|
92
|
|
|
$companyBusinessUnitTransfer = $I->haveCompanyBusinessUnit([ |
93
|
|
|
CompanyBusinessUnitTransfer::FK_COMPANY => $companyTransfer->getIdCompany(), |
94
|
|
|
CompanyBusinessUnitTransfer::ADDRESS_COLLECTION => (new CompanyUnitAddressCollectionTransfer()) |
95
|
|
|
->addCompanyUnitAddress($this->companyUnitAddressTransfer), |
96
|
|
|
]); |
97
|
|
|
|
98
|
|
|
$I->haveCompanyUnitAddressToCompanyBusinessUnitRelation($companyBusinessUnitTransfer); |
99
|
|
|
|
100
|
|
|
$this->companyUserTransfer = $I->haveCompanyUser([ |
101
|
|
|
CompanyUserTransfer::CUSTOMER => $customerTransfer, |
102
|
|
|
CompanyUserTransfer::FK_COMPANY => $companyTransfer->getIdCompany(), |
103
|
|
|
CompanyUserTransfer::FK_COMPANY_BUSINESS_UNIT => $companyBusinessUnitTransfer->getIdCompanyBusinessUnit(), |
104
|
|
|
]); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
protected function createPersistentQuoteWithItemsAndItemLevelShipment(CheckoutApiTester $I): QuoteTransfer |
108
|
|
|
{ |
109
|
|
|
$shipmentMethodTransfer = $I->haveShipmentMethod( |
110
|
|
|
[ |
111
|
|
|
ShipmentMethodTransfer::CARRIER_NAME => 'Spryker Dummy Shipment', |
112
|
|
|
ShipmentMethodTransfer::NAME => 'Standard', |
113
|
|
|
], |
114
|
|
|
[], |
115
|
|
|
ShipmentMethodDataHelper::DEFAULT_PRICE_LIST, |
116
|
|
|
[ |
117
|
|
|
$I->getStoreFacade()->getCurrentStore()->getIdStore(), |
118
|
|
|
], |
119
|
|
|
); |
120
|
|
|
|
121
|
|
|
return $I->havePersistentQuoteWithItemsAndItemLevelShipment( |
122
|
|
|
$this->customerTransfer, |
123
|
|
|
[$I->getQuoteItemOverrideData($I->haveProductWithStock(), $shipmentMethodTransfer, 5)], |
124
|
|
|
); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
protected function mockCompanyPostSavePlugins(CheckoutApiTester $I): void |
128
|
|
|
{ |
129
|
|
|
$I->setDependency(CompanyDependencyProvider::COMPANY_POST_SAVE_PLUGINS, []); |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths