|
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\Yves\Checkout\Process\Steps; |
|
11
|
|
|
|
|
12
|
|
|
use Codeception\Test\Unit; |
|
13
|
|
|
use Generated\Shared\Transfer\AddressTransfer; |
|
|
|
|
|
|
14
|
|
|
use Generated\Shared\Transfer\PaymentTransfer; |
|
|
|
|
|
|
15
|
|
|
use Generated\Shared\Transfer\QuoteTransfer; |
|
|
|
|
|
|
16
|
|
|
use Generated\Shared\Transfer\ShipmentTransfer; |
|
|
|
|
|
|
17
|
|
|
use SprykerShop\Yves\CheckoutPage\CheckoutPageConfig; |
|
18
|
|
|
use SprykerShop\Yves\CheckoutPage\Dependency\Client\CheckoutPageToCheckoutClientInterface; |
|
19
|
|
|
use SprykerShop\Yves\CheckoutPage\Dependency\Client\CheckoutPageToProductBundleClientInterface; |
|
20
|
|
|
use SprykerShop\Yves\CheckoutPage\Dependency\Service\CheckoutPageToShipmentServiceBridge; |
|
21
|
|
|
use SprykerShop\Yves\CheckoutPage\Dependency\Service\CheckoutPageToShipmentServiceInterface; |
|
22
|
|
|
use SprykerShop\Yves\CheckoutPage\Process\Steps\SummaryStep; |
|
23
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Auto-generated group annotations |
|
27
|
|
|
* |
|
28
|
|
|
* @group PyzTest |
|
29
|
|
|
* @group Yves |
|
30
|
|
|
* @group Checkout |
|
31
|
|
|
* @group Process |
|
32
|
|
|
* @group Steps |
|
33
|
|
|
* @group SummaryStepTest |
|
34
|
|
|
* Add your own group annotations below this line |
|
35
|
|
|
*/ |
|
36
|
|
|
class SummaryStepTest extends Unit |
|
37
|
|
|
{ |
|
38
|
|
|
/** |
|
39
|
|
|
* @var \PyzTest\Yves\Checkout\CheckoutBusinessTester |
|
40
|
|
|
*/ |
|
41
|
|
|
public $tester; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @return void |
|
45
|
|
|
*/ |
|
46
|
|
|
public function testPostConditionShouldReturnWhenQuoteReadyForSummaryDisplay(): void |
|
47
|
|
|
{ |
|
48
|
|
|
$summaryStep = $this->createSummaryStep(); |
|
49
|
|
|
|
|
50
|
|
|
$quoteTransfer = new QuoteTransfer(); |
|
51
|
|
|
$quoteTransfer->setBillingAddress(new AddressTransfer()); |
|
52
|
|
|
|
|
53
|
|
|
$paymentTransfer = new PaymentTransfer(); |
|
54
|
|
|
$paymentTransfer->setPaymentProvider('test'); |
|
55
|
|
|
|
|
56
|
|
|
$quoteTransfer->setPayment($paymentTransfer); |
|
57
|
|
|
$quoteTransfer->setShipment(new ShipmentTransfer()); |
|
58
|
|
|
|
|
59
|
|
|
$this->assertTrue($summaryStep->postCondition($quoteTransfer)); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return void |
|
64
|
|
|
*/ |
|
65
|
|
|
public function testRequireInputShouldBeTrue(): void |
|
66
|
|
|
{ |
|
67
|
|
|
$summaryStep = $this->createSummaryStep(); |
|
68
|
|
|
|
|
69
|
|
|
$this->assertTrue($summaryStep->requireInput(new QuoteTransfer())); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @return \SprykerShop\Yves\CheckoutPage\Process\Steps\SummaryStep |
|
74
|
|
|
*/ |
|
75
|
|
|
protected function createSummaryStep(): SummaryStep |
|
76
|
|
|
{ |
|
77
|
|
|
$productBundleClient = $this->createProductBundleClient(); |
|
78
|
|
|
|
|
79
|
|
|
return new SummaryStep( |
|
80
|
|
|
$productBundleClient, |
|
81
|
|
|
$this->createShipmentServiceMock(), |
|
82
|
|
|
$this->createConfigMock(), |
|
83
|
|
|
$this->getCheckoutClientMock(), |
|
84
|
|
|
[], |
|
85
|
|
|
[], |
|
86
|
|
|
'shipment', |
|
87
|
|
|
'escape_route', |
|
88
|
|
|
); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @return \PHPUnit\Framework\MockObject\MockObject|\SprykerShop\Yves\CheckoutPage\Dependency\Client\CheckoutPageToProductBundleClientInterface |
|
93
|
|
|
*/ |
|
94
|
|
|
protected function createProductBundleClient(): CheckoutPageToProductBundleClientInterface |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->getMockBuilder(CheckoutPageToProductBundleClientInterface::class)->getMock(); |
|
|
|
|
|
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @return \Symfony\Component\HttpFoundation\Request |
|
101
|
|
|
*/ |
|
102
|
|
|
protected function createRequest(): Request |
|
103
|
|
|
{ |
|
104
|
|
|
return Request::createFromGlobals(); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* @return \PHPUnit\Framework\MockObject\MockObject|\SprykerShop\Yves\CheckoutPage\Dependency\Service\CheckoutPageToShipmentServiceInterface |
|
109
|
|
|
*/ |
|
110
|
|
|
protected function createShipmentServiceMock(): CheckoutPageToShipmentServiceInterface |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->getMockBuilder(CheckoutPageToShipmentServiceBridge::class) |
|
|
|
|
|
|
113
|
|
|
->setConstructorArgs([$this->tester->getShipmentService()]) |
|
114
|
|
|
->enableProxyingToOriginalMethods() |
|
115
|
|
|
->getMock(); |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* @return \PHPUnit\Framework\MockObject\MockObject|\SprykerShop\Yves\CheckoutPage\CheckoutPageConfig |
|
120
|
|
|
*/ |
|
121
|
|
|
protected function createConfigMock(): CheckoutPageConfig |
|
122
|
|
|
{ |
|
123
|
|
|
return $this->getMockBuilder(CheckoutPageConfig::class)->getMock(); |
|
|
|
|
|
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* @return \PHPUnit\Framework\MockObject\MockObject|\SprykerShop\Yves\CheckoutPage\Dependency\Client\CheckoutPageToCheckoutClientInterface |
|
128
|
|
|
*/ |
|
129
|
|
|
public function getCheckoutClientMock(): CheckoutPageToCheckoutClientInterface |
|
130
|
|
|
{ |
|
131
|
|
|
return $this->getMockBuilder(CheckoutPageToCheckoutClientInterface::class)->getMock(); |
|
|
|
|
|
|
132
|
|
|
} |
|
133
|
|
|
} |
|
134
|
|
|
|
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