|
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\Zed\MessageBroker\MessageHandlers\TaxApp\Communication; |
|
9
|
|
|
|
|
10
|
|
|
use Codeception\Test\Unit; |
|
11
|
|
|
use Generated\Shared\Transfer\ConfigureTaxAppTransfer; |
|
|
|
|
|
|
12
|
|
|
use Generated\Shared\Transfer\MessageAttributesTransfer; |
|
|
|
|
|
|
13
|
|
|
use Generated\Shared\Transfer\StoreTransfer; |
|
|
|
|
|
|
14
|
|
|
use PyzTest\Zed\MessageBroker\TaxAppCommunicationTester; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Auto-generated group annotations |
|
18
|
|
|
* |
|
19
|
|
|
* @group PyzTest |
|
20
|
|
|
* @group Zed |
|
21
|
|
|
* @group MessageBroker |
|
22
|
|
|
* @group MessageHandlers |
|
23
|
|
|
* @group TaxApp |
|
24
|
|
|
* @group Communication |
|
25
|
|
|
* @group TaxAppConfigMessageTest |
|
26
|
|
|
* Add your own group annotations below this line |
|
27
|
|
|
*/ |
|
28
|
|
|
class TaxAppConfigMessageTest extends Unit |
|
29
|
|
|
{ |
|
30
|
|
|
/** |
|
31
|
|
|
* @var string |
|
32
|
|
|
*/ |
|
33
|
|
|
protected const STORE_REFERENCE = 'DE'; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
protected const VENDOR_CODE = 'VENDOR_CODE'; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @var \PyzTest\Zed\MessageBroker\TaxAppCommunicationTester |
|
42
|
|
|
*/ |
|
43
|
|
|
protected TaxAppCommunicationTester $tester; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @return void |
|
47
|
|
|
*/ |
|
48
|
|
|
public function testConfigureTaxAppMessageIsSuccessfullyHandled(): void |
|
49
|
|
|
{ |
|
50
|
|
|
// Arrange |
|
51
|
|
|
$storeTransfer = $this->tester->getAllowedStore(); |
|
52
|
|
|
$this->tester->setStoreReferenceData([$storeTransfer->getName() => static::STORE_REFERENCE]); |
|
53
|
|
|
|
|
54
|
|
|
$configureTaxAppTransfer = $this->tester->buildConfigureTaxAppTransfer([ |
|
55
|
|
|
MessageAttributesTransfer::STORE_REFERENCE => static::STORE_REFERENCE, |
|
56
|
|
|
], [ |
|
57
|
|
|
ConfigureTaxAppTransfer::VENDOR_CODE => static::VENDOR_CODE, |
|
58
|
|
|
ConfigureTaxAppTransfer::API_URL => 'url', |
|
59
|
|
|
ConfigureTaxAppTransfer::IS_ACTIVE => true, |
|
60
|
|
|
]); |
|
61
|
|
|
|
|
62
|
|
|
// Act |
|
63
|
|
|
$this->tester->handleTaxAppMessage($configureTaxAppTransfer); |
|
64
|
|
|
|
|
65
|
|
|
// Assert |
|
66
|
|
|
$this->tester->assertTaxAppConfigIsSavedCorrectlyForStore($storeTransfer, $configureTaxAppTransfer); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @return void |
|
71
|
|
|
*/ |
|
72
|
|
|
public function testDeleteTaxAppMessageIsSuccessfullyHandled(): void |
|
73
|
|
|
{ |
|
74
|
|
|
// Arrange |
|
75
|
|
|
$storeTransfer = $this->tester->getAllowedStore(); |
|
76
|
|
|
$this->tester->setStoreReferenceData([$storeTransfer->getName() => static::STORE_REFERENCE]); |
|
77
|
|
|
|
|
78
|
|
|
$this->createDummyTaxAppConfig($storeTransfer); |
|
79
|
|
|
|
|
80
|
|
|
$deleteTaxAppTransfer = $this->tester->buildDeleteTaxAppTransfer([ |
|
81
|
|
|
MessageAttributesTransfer::STORE_REFERENCE => static::STORE_REFERENCE, |
|
82
|
|
|
], [ |
|
83
|
|
|
ConfigureTaxAppTransfer::VENDOR_CODE => static::VENDOR_CODE, |
|
84
|
|
|
]); |
|
85
|
|
|
|
|
86
|
|
|
// Act |
|
87
|
|
|
$this->tester->handleTaxAppMessage($deleteTaxAppTransfer); |
|
88
|
|
|
|
|
89
|
|
|
// Assert |
|
90
|
|
|
$this->tester->assertTaxAppConfigIsRemovedForStore($storeTransfer, $deleteTaxAppTransfer); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @param \Generated\Shared\Transfer\StoreTransfer $storeTransfer |
|
95
|
|
|
* |
|
96
|
|
|
* @return void |
|
97
|
|
|
*/ |
|
98
|
|
|
protected function createDummyTaxAppConfig(StoreTransfer $storeTransfer): void |
|
|
|
|
|
|
99
|
|
|
{ |
|
100
|
|
|
$this->tester->handleTaxAppMessage( |
|
101
|
|
|
$this->tester->buildConfigureTaxAppTransfer([ |
|
102
|
|
|
MessageAttributesTransfer::STORE_REFERENCE => static::STORE_REFERENCE, |
|
103
|
|
|
ConfigureTaxAppTransfer::VENDOR_CODE => static::VENDOR_CODE, |
|
104
|
|
|
]), |
|
105
|
|
|
); |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
|
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