|
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\Zed\MessageBroker; |
|
11
|
|
|
|
|
12
|
|
|
use Codeception\Actor; |
|
13
|
|
|
use Generated\Shared\DataBuilder\MessageAttributesBuilder; |
|
|
|
|
|
|
14
|
|
|
use Generated\Shared\Transfer\AddPaymentMethodTransfer; |
|
|
|
|
|
|
15
|
|
|
use Generated\Shared\Transfer\DeletePaymentMethodTransfer; |
|
|
|
|
|
|
16
|
|
|
use Orm\Zed\Payment\Persistence\SpyPaymentMethodQuery; |
|
17
|
|
|
use Orm\Zed\Payment\Persistence\SpyPaymentMethodStoreQuery; |
|
18
|
|
|
use Ramsey\Uuid\Uuid; |
|
19
|
|
|
use Spryker\Zed\Payment\Business\Generator\PaymentMethodKeyGenerator; |
|
20
|
|
|
use Spryker\Zed\Payment\Dependency\Service\PaymentToUtilTextServiceBridge; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Inherited Methods |
|
24
|
|
|
* |
|
25
|
|
|
* @method void wantTo($text) |
|
26
|
|
|
* @method void wantToTest($text) |
|
27
|
|
|
* @method void execute($callable) |
|
28
|
|
|
* @method void expectTo($prediction) |
|
29
|
|
|
* @method void expect($prediction) |
|
30
|
|
|
* @method void amGoingTo($argumentation) |
|
31
|
|
|
* @method void am($role) |
|
32
|
|
|
* @method void lookForwardTo($achieveValue) |
|
33
|
|
|
* @method void comment($description) |
|
34
|
|
|
* @method void pause($vars = []) |
|
35
|
|
|
* |
|
36
|
|
|
* @SuppressWarnings(\PyzTest\Zed\MessageBroker\PHPMD) |
|
37
|
|
|
*/ |
|
38
|
|
|
class PaymentMethodPresentationTester extends Actor |
|
39
|
|
|
{ |
|
40
|
|
|
use _generated\PaymentMethodPresentationTesterActions { |
|
|
|
|
|
|
41
|
|
|
haveAddPaymentMethodTransfer as protected testerHaveAddPaymentMethodTransferAction; |
|
42
|
|
|
haveDeletePaymentMethodTransfer as protected testerHaveDeletePaymentMethodTransferAction; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param array<string, mixed> $seedData |
|
47
|
|
|
* @param array<string, mixed> $messageAttributesSeedData |
|
48
|
|
|
*/ |
|
49
|
|
|
public function haveAddPaymentMethodTransfer( |
|
50
|
|
|
array $seedData, |
|
51
|
|
|
array $messageAttributesSeedData = [], |
|
52
|
|
|
): AddPaymentMethodTransfer { |
|
53
|
|
|
return $this->testerHaveAddPaymentMethodTransferAction($seedData) |
|
54
|
|
|
->setMessageAttributes( |
|
55
|
|
|
(new MessageAttributesBuilder($messageAttributesSeedData))->build(), |
|
56
|
|
|
); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @param array<string, mixed> $seedData |
|
61
|
|
|
* @param array<string, mixed> $messageAttributesSeedData |
|
62
|
|
|
*/ |
|
63
|
|
|
public function haveDeletePaymentMethodTransfer( |
|
64
|
|
|
array $seedData, |
|
65
|
|
|
array $messageAttributesSeedData = [], |
|
66
|
|
|
): DeletePaymentMethodTransfer { |
|
67
|
|
|
return $this->testerHaveDeletePaymentMethodTransferAction($seedData) |
|
68
|
|
|
->setMessageAttributes( |
|
69
|
|
|
(new MessageAttributesBuilder($messageAttributesSeedData))->build(), |
|
70
|
|
|
); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function generatePaymentMethodKey( |
|
74
|
|
|
string $paymentProviderName, |
|
75
|
|
|
string $paymentMethodName, |
|
76
|
|
|
): string { |
|
77
|
|
|
$utilTextService = $this->getLocator()->utilText()->service(); |
|
78
|
|
|
$paymentMethodKeyGenerator = new PaymentMethodKeyGenerator( |
|
79
|
|
|
new PaymentToUtilTextServiceBridge($utilTextService), |
|
80
|
|
|
); |
|
81
|
|
|
|
|
82
|
|
|
return $paymentMethodKeyGenerator->generate( |
|
83
|
|
|
$paymentProviderName, |
|
84
|
|
|
$paymentMethodName, |
|
85
|
|
|
); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function cleanupPaymentMethodByPaymentMethodKey(string $paymentMethodKey): void |
|
89
|
|
|
{ |
|
90
|
|
|
$this->addCleanup(function () use ($paymentMethodKey): void { |
|
91
|
|
|
$paymentMethod = SpyPaymentMethodQuery::create() |
|
92
|
|
|
->filterByPaymentMethodKey($paymentMethodKey) |
|
93
|
|
|
->findOne(); |
|
94
|
|
|
|
|
95
|
|
|
if ($paymentMethod === null) { |
|
96
|
|
|
return; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
SpyPaymentMethodStoreQuery::create() |
|
100
|
|
|
->filterByFkPaymentMethod($paymentMethod->getIdPaymentMethod()) |
|
101
|
|
|
->delete(); |
|
102
|
|
|
|
|
103
|
|
|
$paymentMethod->delete(); |
|
104
|
|
|
}); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
protected function getUuid(): string |
|
108
|
|
|
{ |
|
109
|
|
|
return Uuid::uuid4()->toString(); |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|
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