|
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
|
|
|
namespace PyzTest\Glue\PriceProductVolumes\RestApi; |
|
9
|
|
|
|
|
10
|
|
|
use Codeception\Util\HttpCode; |
|
11
|
|
|
use PyzTest\Glue\PriceProductVolumes\PriceProductVolumesApiTester; |
|
12
|
|
|
use PyzTest\Glue\PriceProductVolumes\RestApi\Fixtures\PriceProductVolumesRestApiFixtures; |
|
13
|
|
|
use Spryker\Glue\ProductPricesRestApi\ProductPricesRestApiConfig; |
|
14
|
|
|
use Spryker\Glue\ProductsRestApi\ProductsRestApiConfig; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Auto-generated group annotations |
|
18
|
|
|
* |
|
19
|
|
|
* @group PyzTest |
|
20
|
|
|
* @group Glue |
|
21
|
|
|
* @group PriceProductVolumes |
|
22
|
|
|
* @group RestApi |
|
23
|
|
|
* @group ProductAbstractPriceProductVolumesRestApiCest |
|
24
|
|
|
* Add your own group annotations below this line |
|
25
|
|
|
* @group EndToEnd |
|
26
|
|
|
*/ |
|
27
|
|
|
class ProductAbstractPriceProductVolumesRestApiCest |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* @var \PyzTest\Glue\PriceProductVolumes\RestApi\Fixtures\PriceProductVolumesRestApiFixtures |
|
31
|
|
|
*/ |
|
32
|
|
|
protected PriceProductVolumesRestApiFixtures $fixtures; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @param \PyzTest\Glue\PriceProductVolumes\PriceProductVolumesApiTester $I |
|
36
|
|
|
* |
|
37
|
|
|
* @return void |
|
38
|
|
|
*/ |
|
39
|
|
|
public function loadFixtures(PriceProductVolumesApiTester $I): void |
|
40
|
|
|
{ |
|
41
|
|
|
/** @var \PyzTest\Glue\PriceProductVolumes\RestApi\Fixtures\PriceProductVolumesRestApiFixtures $fixtures */ |
|
42
|
|
|
$fixtures = $I->loadFixtures(PriceProductVolumesRestApiFixtures::class); |
|
43
|
|
|
|
|
44
|
|
|
$this->fixtures = $fixtures; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @depends loadFixtures |
|
49
|
|
|
* |
|
50
|
|
|
* @param \PyzTest\Glue\PriceProductVolumes\PriceProductVolumesApiTester $I |
|
51
|
|
|
* |
|
52
|
|
|
* @return void |
|
53
|
|
|
*/ |
|
54
|
|
|
public function requestProductAbstractPrices(PriceProductVolumesApiTester $I): void |
|
55
|
|
|
{ |
|
56
|
|
|
// Arrange |
|
57
|
|
|
$customerTransfer = $this->fixtures->getCustomerTransfer(); |
|
58
|
|
|
$I->authorizeCustomerToGlue($customerTransfer); |
|
59
|
|
|
|
|
60
|
|
|
// Act |
|
61
|
|
|
$I->sendGET($I->formatFullUrl( |
|
62
|
|
|
'{resourceAbstractProducts}/{productAbstractSku}/{resourceAbstractProductPrices}', |
|
63
|
|
|
[ |
|
64
|
|
|
'resourceAbstractProducts' => ProductsRestApiConfig::RESOURCE_ABSTRACT_PRODUCTS, |
|
65
|
|
|
'resourceAbstractProductPrices' => ProductPricesRestApiConfig::RESOURCE_ABSTRACT_PRODUCT_PRICES, |
|
66
|
|
|
'productAbstractSku' => $this->fixtures->getProductConcreteTransfer()->getAbstractSku(), |
|
67
|
|
|
], |
|
68
|
|
|
)); |
|
69
|
|
|
|
|
70
|
|
|
// Assert |
|
71
|
|
|
$I->seeResponseCodeIs(HttpCode::OK); |
|
72
|
|
|
$I->seeResponseIsJson(); |
|
73
|
|
|
$I->seeResponseMatchesOpenApiSchema(); |
|
74
|
|
|
|
|
75
|
|
|
$I->amSure('Returned resource is of type abstract-product-prices') |
|
76
|
|
|
->whenI() |
|
77
|
|
|
->seeResponseDataContainsResourceCollectionOfTypeWithSizeOf(ProductPricesRestApiConfig::RESOURCE_ABSTRACT_PRODUCT_PRICES, 1); |
|
|
|
|
|
|
78
|
|
|
|
|
79
|
|
|
$I->amSure('Returned resource has correct id') |
|
80
|
|
|
->whenI() |
|
81
|
|
|
->seeResourceCollectionHasResourceWithId($this->fixtures->getProductConcreteTransfer()->getAbstractSku()); |
|
|
|
|
|
|
82
|
|
|
|
|
83
|
|
|
$I->amSure('Returned resource has volume prices') |
|
84
|
|
|
->whenI() |
|
85
|
|
|
->seeResourceCollectionHasAttribute($this->fixtures::VOLUME_PRICE_ATTRIBUTE_JSON_PATH); |
|
|
|
|
|
|
86
|
|
|
|
|
87
|
|
|
$I->amSure('Returned volume prices are correct') |
|
88
|
|
|
->whenI() |
|
89
|
|
|
->seeVolumePricesEqualToExpectedValue($this->fixtures::VOLUME_PRICE_DATA); |
|
|
|
|
|
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
|