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\OrderAmendments; |
11
|
|
|
|
12
|
|
|
use Generated\Shared\Transfer\CustomerTransfer; |
|
|
|
|
13
|
|
|
use Generated\Shared\Transfer\MoneyValueTransfer; |
|
|
|
|
14
|
|
|
use Generated\Shared\Transfer\PriceProductTransfer; |
|
|
|
|
15
|
|
|
use Generated\Shared\Transfer\ProductConcreteTransfer; |
|
|
|
|
16
|
|
|
use Generated\Shared\Transfer\StockProductTransfer; |
|
|
|
|
17
|
|
|
use Generated\Shared\Transfer\StoreTransfer; |
|
|
|
|
18
|
|
|
use Spryker\Glue\CartReorderRestApi\CartReorderRestApiConfig; |
19
|
|
|
use SprykerTest\Glue\Testify\Tester\ApiEndToEndTester; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Inherited Methods |
23
|
|
|
* |
24
|
|
|
* @method void wantTo($text) |
25
|
|
|
* @method void wantToTest($text) |
26
|
|
|
* @method void execute($callable) |
27
|
|
|
* @method void expectTo($prediction) |
28
|
|
|
* @method void expect($prediction) |
29
|
|
|
* @method void amGoingTo($argumentation) |
30
|
|
|
* @method void am($role) |
31
|
|
|
* @method void lookForwardTo($achieveValue) |
32
|
|
|
* @method void comment($description) |
33
|
|
|
* @method void pause($vars = []) |
34
|
|
|
* |
35
|
|
|
* @SuppressWarnings(PHPMD) |
36
|
|
|
*/ |
37
|
|
|
class OrderAmendmentsApiTester extends ApiEndToEndTester |
38
|
|
|
{ |
39
|
|
|
use _generated\OrderAmendmentsApiTesterActions; |
|
|
|
|
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer |
43
|
|
|
* |
44
|
|
|
* @return void |
45
|
|
|
*/ |
46
|
|
|
public function authorizeCustomerToGlue(CustomerTransfer $customerTransfer): void |
47
|
|
|
{ |
48
|
|
|
$oauthResponseTransfer = $this->haveAuthorizationToGlue($customerTransfer); |
49
|
|
|
$this->amBearerAuthenticated($oauthResponseTransfer->getAccessToken()); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param string $orderReference |
54
|
|
|
* |
55
|
|
|
* @return void |
56
|
|
|
*/ |
57
|
|
|
public function assertResponseContainsAmendmentOrderReference(string $orderReference): void |
58
|
|
|
{ |
59
|
|
|
$attributes = $this->getDataFromResponseByJsonPath('$.data.attributes'); |
60
|
|
|
|
61
|
|
|
$this->assertArrayHasKey('amendmentOrderReference', $attributes); |
62
|
|
|
$this->assertSame($orderReference, $attributes['amendmentOrderReference']); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return string |
67
|
|
|
*/ |
68
|
|
|
public function getCartReorderUrl(): string |
69
|
|
|
{ |
70
|
|
|
return $this->formatUrl('{cartReorderResource}?include=items', [ |
71
|
|
|
'cartReorderResource' => CartReorderRestApiConfig::RESOURCE_CART_REORDER, |
72
|
|
|
]); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param string $sku |
77
|
|
|
* |
78
|
|
|
* @return string |
79
|
|
|
*/ |
80
|
|
|
public function getConcreteProductPricesUrl(string $sku): string |
81
|
|
|
{ |
82
|
|
|
return $this->formatUrl('concrete-products/{sku}/concrete-product-prices', ['sku' => $sku]); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return \Generated\Shared\Transfer\StoreTransfer |
87
|
|
|
*/ |
88
|
|
|
public function getCurrentStore(): StoreTransfer |
89
|
|
|
{ |
90
|
|
|
return $this->getLocator()->store()->facade()->getCurrentStore(); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @param int|null $unitPrice |
95
|
|
|
* |
96
|
|
|
* @return \Generated\Shared\Transfer\ProductConcreteTransfer |
97
|
|
|
*/ |
98
|
|
|
public function haveProductWithPriceAndStock(?int $unitPrice = 10000): ProductConcreteTransfer |
99
|
|
|
{ |
100
|
|
|
$storeTransfer = $this->getLocator()->store()->facade()->getCurrentStore(); |
101
|
|
|
$productConcreteTransfer = $this->haveFullProduct(); |
102
|
|
|
|
103
|
|
|
$this->haveProductInStockForStore($storeTransfer, [ |
104
|
|
|
StockProductTransfer::SKU => $productConcreteTransfer->getSku(), |
105
|
|
|
StockProductTransfer::IS_NEVER_OUT_OF_STOCK => 1, |
106
|
|
|
]); |
107
|
|
|
|
108
|
|
|
$priceProductTransfer = $this->havePriceProduct([ |
109
|
|
|
PriceProductTransfer::SKU_PRODUCT_ABSTRACT => $productConcreteTransfer->getAbstractSku(), |
110
|
|
|
PriceProductTransfer::SKU_PRODUCT => $productConcreteTransfer->getSku(), |
111
|
|
|
PriceProductTransfer::ID_PRODUCT => $productConcreteTransfer->getIdProductConcrete(), |
112
|
|
|
PriceProductTransfer::PRICE_TYPE_NAME => 'DEFAULT', |
113
|
|
|
PriceProductTransfer::MONEY_VALUE => [ |
114
|
|
|
MoneyValueTransfer::NET_AMOUNT => $unitPrice, |
115
|
|
|
MoneyValueTransfer::GROSS_AMOUNT => $unitPrice, |
116
|
|
|
], |
117
|
|
|
]); |
118
|
|
|
|
119
|
|
|
$productConcreteTransfer->addPrice($priceProductTransfer); |
120
|
|
|
|
121
|
|
|
return $productConcreteTransfer; |
122
|
|
|
} |
123
|
|
|
} |
124
|
|
|
|
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