Passed
Push — bugfix/supesc-135-easycredit-m... ( ed8289...21216f )
by
unknown
03:08
created

AbstractEasycreditTest   A

Complexity

Total Complexity 25

Size/Duplication

Total Lines 385
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 25
eloc 133
dl 0
loc 385
rs 10
c 0
b 0
f 0

25 Methods

Rating   Name   Duplication   Size   Complexity  
A prepareShipmentTransfer() 0 5 1
A getAdapterFactoryMock() 0 8 1
A prepareItemTransfers() 0 6 1
A prepareTotalsTransfer() 0 6 1
A getLoggerMock() 0 8 1
A prepareEasycreditInitializePaymentResponseTransfer() 0 7 1
A getConfigMock() 0 11 1
A getParserMock() 0 22 1
A getMapperMock() 0 7 1
A prepareAddressTransfer() 0 5 1
A createMapper() 0 5 1
A getRequestSender() 0 9 1
A prepareCustomerTransfer() 0 5 1
A prepareEasycreditQueryAssessmentResponseTransfer() 0 7 1
A prepareEasycreditApprovalTextResponseTransfer() 0 7 1
A getEasycreditEntityManagerMock() 0 6 1
A preparePaymentMethodsTransfer() 0 9 1
A prepareEasycreditPreContractualInformationAndRedemptionPlanResponseTransfer() 0 7 1
A createEasycreditBusinessFactoryMock() 0 19 1
A getEasycreditRepositoryMock() 0 11 1
A prepareEasycreditOrderConfirmationResponseTransfer() 0 7 1
A prepareEasycreditDisplayInterestAndAdjustTotalSumResponseTransfer() 0 7 1
A preparePaymentTransfer() 0 10 1
A prepareFacade() 0 6 1
A prepareQuoteTransfer() 0 5 1
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEcoTest\Zed\Easycredit;
9
10
use ArrayObject;
11
use Codeception\Test\Unit;
12
use Generated\Shared\DataBuilder\AddressBuilder;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\DataBuilder\AddressBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Generated\Shared\DataBuilder\CustomerBuilder;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\DataBuilder\CustomerBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Generated\Shared\DataBuilder\ItemBuilder;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\DataBuilder\ItemBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Generated\Shared\DataBuilder\ShipmentBuilder;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\DataBuilder\ShipmentBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Generated\Shared\Transfer\AddressTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\AddressTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Generated\Shared\Transfer\CustomerTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\CustomerTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Generated\Shared\Transfer\EasycreditApprovalTextResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...valTextResponseTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use Generated\Shared\Transfer\EasycreditInitializePaymentResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...PaymentResponseTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
use Generated\Shared\Transfer\EasycreditInterestAndAdjustTotalSumResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...otalSumResponseTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
use Generated\Shared\Transfer\EasycreditOrderConfirmationResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...rmationResponseTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
22
use Generated\Shared\Transfer\EasycreditPreContractualInformationAndRedemptionPlanResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ionPlanResponseTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
use Generated\Shared\Transfer\EasycreditQueryCreditAssessmentResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...essmentResponseTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
use Generated\Shared\Transfer\EasycreditTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\EasycreditTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
use Generated\Shared\Transfer\PaymentEasycreditOrderIdentifierTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...OrderIdentifierTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
use Generated\Shared\Transfer\PaymentMethodsTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentMethodsTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
27
use Generated\Shared\Transfer\PaymentMethodTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentMethodTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
28
use Generated\Shared\Transfer\PaymentTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
29
use Generated\Shared\Transfer\QuoteTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\QuoteTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
30
use Generated\Shared\Transfer\ShipmentTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\ShipmentTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
31
use Generated\Shared\Transfer\TotalsTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\TotalsTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
32
use SprykerEco\Shared\Easycredit\EasycreditConfig;
33
use SprykerEco\Zed\Easycredit\Business\Api\Adapter\Http\Factory\AdapterFactoryInterface;
34
use SprykerEco\Zed\Easycredit\Business\Api\RequestSender\RequestSender;
35
use SprykerEco\Zed\Easycredit\Business\Api\RequestSender\RequestSenderInterface;
36
use SprykerEco\Zed\Easycredit\Business\EasycreditBusinessFactory;
37
use SprykerEco\Zed\Easycredit\Business\EasycreditFacade;
38
use SprykerEco\Zed\Easycredit\Business\Logger\EasycreditLogger;
39
use SprykerEco\Zed\Easycredit\Business\Mapper\EasycreditMapper;
40
use SprykerEco\Zed\Easycredit\Business\Mapper\MapperInterface;
41
use SprykerEco\Zed\Easycredit\Business\Parser\ResponseParserInterface;
42
use SprykerEco\Zed\Easycredit\EasycreditConfig as ZedEasycreditConfig;
43
use SprykerEco\Zed\Easycredit\Persistence\EasycreditEntityManager;
44
use SprykerEco\Zed\Easycredit\Persistence\EasycreditEntityManagerInterface;
45
use SprykerEco\Zed\Easycredit\Persistence\EasycreditRepositoryInterface;
46
47
/**
48
 * @group SprykerEcoTest
49
 * @group Zed
50
 * @group Easycredit
51
 * @group EasycreditTest
52
 */
53
abstract class AbstractEasycreditTest extends Unit
54
{
55
    /**
56
     * @var string
57
     */
58
59
    protected const REQUEST_KEY_ORDER_AMOUNT = 'bestellwert';
60
61
    /**
62
     * @var string
63
     */
64
    protected const RESPONSE_KEY_PAYMENT_IDENTIFIER = 'payment_identifier';
65
66
    /**
67
     * @var string
68
     */
69
    protected const RESPONSE_KEY_STATUS = 'status';
70
71
    /**
72
     * @var string
73
     */
74
    protected const RESPONSE_KEY_TEXT = 'text';
75
76
    /**
77
     * @var string
78
     */
79
    protected const RESPONSE_KEY_ANFALLENDE_ZINSEN = '123.45';
80
81
    /**
82
     * @var string
83
     */
84
    protected const RESPONSE_KEY_URL_VORVERTRAGLICHE_INFORMATIONEN = 'url';
85
86
    /**
87
     * @var string
88
     */
89
    protected const RESPONSE_KEY_TILGUNGSPLAN_TEXT = 'text';
90
91
    /**
92
     * @var int
93
     */
94
    protected const TOTAL_VALUE_FOR_FILTERED_EASYCREDIT_PAYMENT_METHOD = 20000;
95
96
    /**
97
     * @var int
98
     */
99
    protected const TOTAL_VALUE_FOR_NOT_FILTERED_EASYCREDIT_PAYMENT_METHOD = 200;
100
101
    /**
102
     * @var \SprykerEcoTest\Zed\Easycredit\EasycreditTester
103
     */
104
    protected $tester;
105
106
    /**
107
     * @return \SprykerEco\Zed\Easycredit\Business\EasycreditFacade
108
     */
109
    protected function prepareFacade(): EasycreditFacade
110
    {
111
        $facade = new EasycreditFacade();
112
        $facade->setFactory($this->createEasycreditBusinessFactoryMock());
113
114
        return $facade;
115
    }
116
117
    /**
118
     * @return \SprykerEco\Zed\Easycredit\Business\EasycreditBusinessFactory
119
     */
120
    protected function createEasycreditBusinessFactoryMock(): EasycreditBusinessFactory
121
    {
122
        $factory = $this->getMockBuilder(EasycreditBusinessFactory::class)
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

122
        $factory = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder(EasycreditBusinessFactory::class)

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
123
            ->setMethods([
124
                'getEntityManager',
125
                'getConfig',
126
                'createRequestSender',
127
                'createResponseParser',
128
                'createAdapterFactory',
129
                'createMapper',
130
            ])
131
            ->getMock();
132
133
        $factory->method('getEntityManager')->willReturn(new EasycreditEntityManager());
134
        $factory->method('getConfig')->willReturn($this->getConfigMock());
135
        $factory->method('createRequestSender')->willReturn($this->getRequestSender());
136
        $factory->method('createMapper')->willReturn($this->getMapperMock());
137
138
        return $factory;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $factory returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return SprykerEco\Zed\Easycredi...sycreditBusinessFactory.
Loading history...
139
    }
140
141
    /**
142
     * @return \SprykerEco\Zed\Easycredit\Business\Mapper\EasycreditMapper
143
     */
144
    protected function createMapper(): EasycreditMapper
145
    {
146
        return new EasycreditMapper(
147
            (new EasycreditBusinessFactory())->getConfig(),
148
            (new EasycreditBusinessFactory())->getMoneyPlugin(),
149
        );
150
    }
151
152
    /**
153
     * @return \Generated\Shared\Transfer\QuoteTransfer
154
     */
155
    protected function prepareQuoteTransfer(): QuoteTransfer
156
    {
157
        $quoteTransfer = new QuoteTransfer();
158
159
        return $quoteTransfer;
160
    }
161
162
    /**
163
     * @return \Generated\Shared\Transfer\PaymentMethodsTransfer
164
     */
165
    protected function preparePaymentMethodsTransfer(): PaymentMethodsTransfer
166
    {
167
        $paymentMethodTransfer = new PaymentMethodTransfer();
168
        $paymentMethodTransfer->setMethodName(EasycreditConfig::PAYMENT_METHOD);
169
170
        $paymentMethodsTransfer = new PaymentMethodsTransfer();
171
        $paymentMethodsTransfer->addMethod($paymentMethodTransfer);
172
173
        return $paymentMethodsTransfer;
174
    }
175
176
    /**
177
     * @return \Generated\Shared\Transfer\PaymentTransfer
178
     */
179
    protected function preparePaymentTransfer(): PaymentTransfer
180
    {
181
        $paymentTransfer = new PaymentTransfer();
182
        $paymentTransfer->setPaymentSelection(EasycreditConfig::PAYMENT_METHOD);
183
        $paymentTransfer->setEasycredit(
184
            (new EasycreditTransfer())
185
                ->setVorgangskennung('vorgangskennung'),
186
        );
187
188
        return $paymentTransfer;
189
    }
190
191
    /**
192
     * @param int $grandTotal
193
     *
194
     * @return \Generated\Shared\Transfer\TotalsTransfer
195
     */
196
    protected function prepareTotalsTransfer(int $grandTotal): TotalsTransfer
197
    {
198
        $totalsTransfer = new TotalsTransfer();
199
        $totalsTransfer->setGrandTotal($grandTotal);
200
201
        return $totalsTransfer;
202
    }
203
204
    /**
205
     * @return \ArrayObject<\Generated\Shared\Transfer\ItemTransfer>
206
     */
207
    protected function prepareItemTransfers(): ArrayObject
208
    {
209
        $itemTransfer = (new ItemBuilder())->build();
210
        $itemTransfer->setRefundableAmount(12345);
211
212
        return new ArrayObject([$itemTransfer]);
213
    }
214
215
    /**
216
     * @return \Generated\Shared\Transfer\CustomerTransfer
217
     */
218
    protected function prepareCustomerTransfer(): CustomerTransfer
219
    {
220
        $customerTransfer = (new CustomerBuilder())->build();
221
222
        return $customerTransfer;
223
    }
224
225
    /**
226
     * @return \Generated\Shared\Transfer\AddressTransfer
227
     */
228
    protected function prepareAddressTransfer(): AddressTransfer
229
    {
230
        $addressTransfer = (new AddressBuilder())->build();
231
232
        return $addressTransfer;
233
    }
234
235
    /**
236
     * @return \Generated\Shared\Transfer\ShipmentTransfer
237
     */
238
    protected function prepareShipmentTransfer(): ShipmentTransfer
239
    {
240
        $shipmentTransfer = (new ShipmentBuilder())->build();
241
242
        return $shipmentTransfer;
243
    }
244
245
    /**
246
     * @return \SprykerEco\Zed\Easycredit\EasycreditConfig
247
     */
248
    protected function getConfigMock(): ZedEasycreditConfig
249
    {
250
        $config = $this->getMockBuilder(ZedEasycreditConfig::class)
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

250
        $config = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder(ZedEasycreditConfig::class)

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
251
            ->setMethods([
252
                'getSharedConfig',
253
            ])
254
            ->getMock();
255
256
        $config->method('getSharedConfig')->willReturn(new EasycreditConfig());
257
258
        return $config;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $config returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return SprykerEco\Zed\Easycredit\EasycreditConfig.
Loading history...
259
    }
260
261
    /**
262
     * @return \SprykerEco\Zed\Easycredit\Business\Api\Adapter\Http\Factory\AdapterFactoryInterface
263
     */
264
    protected function getAdapterFactoryMock(): AdapterFactoryInterface
265
    {
266
        $factory = $this->getMockBuilder(AdapterFactoryInterface::class)
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...der::setMethodsExcept() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

266
        $factory = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder(AdapterFactoryInterface::class)

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
267
            ->disableOriginalConstructor()
268
            ->setMethodsExcept()
269
            ->getMock();
270
271
        return $factory;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $factory returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return SprykerEco\Zed\Easycredi...AdapterFactoryInterface.
Loading history...
272
    }
273
274
    /**
275
     * @return \SprykerEco\Zed\Easycredit\Business\Api\RequestSender\RequestSenderInterface
276
     */
277
    protected function getRequestSender(): RequestSenderInterface
278
    {
279
        return new RequestSender(
280
            $this->getMapperMock(),
281
            $this->getAdapterFactoryMock(),
282
            $this->getParserMock(),
283
            $this->getLoggerMock(),
284
            $this->getEasycreditRepositoryMock(),
285
            $this->getEasycreditEntityManagerMock(),
286
        );
287
    }
288
289
    /**
290
     * @return \SprykerEco\Zed\Easycredit\Business\Mapper\MapperInterface
291
     */
292
    protected function getMapperMock(): MapperInterface
293
    {
294
        $mapper = $this->getMockBuilder(MapperInterface::class)
295
            ->disableOriginalConstructor()
296
            ->getMock();
297
298
        return $mapper;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $mapper returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return SprykerEco\Zed\Easycredi...\Mapper\MapperInterface.
Loading history...
299
    }
300
301
    /**
302
     * @return \SprykerEco\Zed\Easycredit\Business\Parser\ResponseParserInterface
303
     */
304
    protected function getParserMock(): ResponseParserInterface
305
    {
306
        $parser = $this->getMockBuilder(ResponseParserInterface::class)
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

306
        $parser = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder(ResponseParserInterface::class)

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
307
            ->disableOriginalConstructor()
308
            ->setMethods([
309
                'parseInitializePaymentResponse',
310
                'parsePreContractualInformationAndRedemptionPlanResponse',
311
                'parseOrderConfirmationResponse',
312
                'parseInterestAndTotalSumResponse',
313
                'parseQueryCreditAssessmentResponse',
314
                'parseApprovalTextResponse',
315
            ])
316
            ->getMock();
317
318
        $parser->method('parseInitializePaymentResponse')->willReturn($this->prepareEasycreditInitializePaymentResponseTransfer());
319
        $parser->method('parsePreContractualInformationAndRedemptionPlanResponse')->willReturn($this->prepareEasycreditPreContractualInformationAndRedemptionPlanResponseTransfer());
320
        $parser->method('parseOrderConfirmationResponse')->willReturn($this->prepareEasycreditOrderConfirmationResponseTransfer());
321
        $parser->method('parseInterestAndTotalSumResponse')->willReturn($this->prepareEasycreditDisplayInterestAndAdjustTotalSumResponseTransfer());
322
        $parser->method('parseQueryCreditAssessmentResponse')->willReturn($this->prepareEasycreditQueryAssessmentResponseTransfer());
323
        $parser->method('parseApprovalTextResponse')->willReturn($this->prepareEasycreditApprovalTextResponseTransfer());
324
325
        return $parser;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $parser returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return SprykerEco\Zed\Easycredi...ResponseParserInterface.
Loading history...
326
    }
327
328
    /**
329
     * @return \SprykerEco\Zed\Easycredit\Business\Logger\EasycreditLogger
330
     */
331
    protected function getLoggerMock(): EasycreditLogger
332
    {
333
        $logger = $this->getMockBuilder(EasycreditLogger::class)
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

333
        $logger = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder(EasycreditLogger::class)

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
334
            ->disableOriginalConstructor()
335
            ->setMethods([])
336
            ->getMock();
337
338
        return $logger;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $logger returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return SprykerEco\Zed\Easycredi...Logger\EasycreditLogger.
Loading history...
339
    }
340
341
    /**
342
     * @return \Generated\Shared\Transfer\EasycreditInitializePaymentResponseTransfer
343
     */
344
    protected function prepareEasycreditInitializePaymentResponseTransfer(): EasycreditInitializePaymentResponseTransfer
345
    {
346
        $transfer = new EasycreditInitializePaymentResponseTransfer();
347
        $transfer->setPaymentIdentifier(static::RESPONSE_KEY_PAYMENT_IDENTIFIER);
348
        $transfer->setSuccess(true);
349
350
        return $transfer;
351
    }
352
353
    /**
354
     * @return \Generated\Shared\Transfer\EasycreditQueryCreditAssessmentResponseTransfer
355
     */
356
    protected function prepareEasycreditQueryAssessmentResponseTransfer(): EasycreditQueryCreditAssessmentResponseTransfer
357
    {
358
        $transfer = new EasycreditQueryCreditAssessmentResponseTransfer();
359
        $transfer->setStatus(static::RESPONSE_KEY_STATUS);
360
        $transfer->setSuccess(true);
361
362
        return $transfer;
363
    }
364
365
    /**
366
     * @return \Generated\Shared\Transfer\EasycreditOrderConfirmationResponseTransfer
367
     */
368
    protected function prepareEasycreditOrderConfirmationResponseTransfer(): EasycreditOrderConfirmationResponseTransfer
369
    {
370
        $transfer = new EasycreditOrderConfirmationResponseTransfer();
371
        $transfer->setConfirmed(false);
372
        $transfer->setSuccess(true);
373
374
        return $transfer;
375
    }
376
377
    /**
378
     * @return \Generated\Shared\Transfer\EasycreditApprovalTextResponseTransfer
379
     */
380
    protected function prepareEasycreditApprovalTextResponseTransfer(): EasycreditApprovalTextResponseTransfer
381
    {
382
        $transfer = new EasycreditApprovalTextResponseTransfer();
383
        $transfer->setText(static::RESPONSE_KEY_TEXT);
384
        $transfer->setSuccess(true);
385
386
        return $transfer;
387
    }
388
389
    /**
390
     * @return \Generated\Shared\Transfer\EasycreditInterestAndAdjustTotalSumResponseTransfer
391
     */
392
    protected function prepareEasycreditDisplayInterestAndAdjustTotalSumResponseTransfer(): EasycreditInterestAndAdjustTotalSumResponseTransfer
393
    {
394
        $transfer = new EasycreditInterestAndAdjustTotalSumResponseTransfer();
395
        $transfer->setAnfallendeZinsen(static::RESPONSE_KEY_ANFALLENDE_ZINSEN);
396
        $transfer->setSuccess(true);
397
398
        return $transfer;
399
    }
400
401
    /**
402
     * @return \Generated\Shared\Transfer\EasycreditPreContractualInformationAndRedemptionPlanResponseTransfer
403
     */
404
    protected function prepareEasycreditPreContractualInformationAndRedemptionPlanResponseTransfer(): EasycreditPreContractualInformationAndRedemptionPlanResponseTransfer
405
    {
406
        $transfer = new EasycreditPreContractualInformationAndRedemptionPlanResponseTransfer();
407
        $transfer->setUrlVorvertraglicheInformationen(static::RESPONSE_KEY_URL_VORVERTRAGLICHE_INFORMATIONEN);
408
        $transfer->setSuccess(true);
409
410
        return $transfer;
411
    }
412
413
    /**
414
     * @return \SprykerEco\Zed\Easycredit\Persistence\EasycreditEntityManagerInterface
415
     */
416
    protected function getEasycreditEntityManagerMock(): EasycreditEntityManagerInterface
417
    {
418
        $em = $this->getMockBuilder(EasycreditEntityManagerInterface::class)
419
            ->getMock();
420
421
        return $em;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $em returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return SprykerEco\Zed\Easycredi...tEntityManagerInterface.
Loading history...
422
    }
423
424
    /**
425
     * @return \SprykerEco\Zed\Easycredit\Persistence\EasycreditRepositoryInterface
426
     */
427
    protected function getEasycreditRepositoryMock(): EasycreditRepositoryInterface
428
    {
429
        $repository = $this->getMockBuilder(EasycreditRepositoryInterface::class)
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

429
        $repository = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder(EasycreditRepositoryInterface::class)

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
430
            ->setMethods([
431
                'findPaymentEasycreditOrderIdentifierByFkSalesOrderItem',
432
            ])
433
            ->getMock();
434
435
        $repository->method('findPaymentEasycreditOrderIdentifierByFkSalesOrderItem')->willReturn(new PaymentEasycreditOrderIdentifierTransfer());
436
437
        return $repository;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $repository returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return SprykerEco\Zed\Easycredi...editRepositoryInterface.
Loading history...
438
    }
439
}
440