8
8
use Magento \Catalog \Model \ProductRepository ;
9
9
use Magento \Customer \Api \Data \CustomerInterfaceFactory ;
10
10
use Magento \Framework \Exception \LocalizedException ;
11
- use Magento \Quote \Api \Data \CartInterface ;
12
11
use Magento \TestFramework \Helper \Bootstrap ;
13
12
use Magento \TestFramework \ObjectManager ;
14
13
use Magento \Framework \Api \SearchCriteriaBuilder ;
15
14
use Magento \Quote \Api \CartRepositoryInterface ;
15
+ use Magento \Framework \Api \ExtensibleDataInterface ;
16
16
17
17
/**
18
18
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -32,7 +32,11 @@ protected function setUp()
32
32
$ this ->objectManager = Bootstrap::getObjectManager ();
33
33
}
34
34
35
- private function convertToArray ($ entity )
35
+ /**
36
+ * @param ExtensibleDataInterface $entity
37
+ * @return array
38
+ */
39
+ private function convertToArray (ExtensibleDataInterface $ entity ): array
36
40
{
37
41
return $ this ->objectManager
38
42
->create (\Magento \Framework \Api \ExtensibleDataObjectConverter::class)
@@ -42,8 +46,9 @@ private function convertToArray($entity)
42
46
/**
43
47
* @magentoDataFixture Magento/Catalog/_files/product_virtual.php
44
48
* @magentoDataFixture Magento/Sales/_files/quote.php
49
+ * @return void
45
50
*/
46
- public function testCollectTotalsWithVirtual ()
51
+ public function testCollectTotalsWithVirtual (): void
47
52
{
48
53
$ quote = $ this ->objectManager ->create (Quote::class);
49
54
$ quote ->load ('test01 ' , 'reserved_order_id ' );
@@ -61,7 +66,10 @@ public function testCollectTotalsWithVirtual()
61
66
$ this ->assertEquals (20 , $ quote ->getBaseGrandTotal ());
62
67
}
63
68
64
- public function testSetCustomerData ()
69
+ /**
70
+ * @return void
71
+ */
72
+ public function testSetCustomerData (): void
65
73
{
66
74
/** @var Quote $quote */
67
75
$ quote = $ this ->objectManager ->create (Quote::class);
@@ -87,7 +95,10 @@ public function testSetCustomerData()
87
95
$ this ->assertEquals ('qa@example.com ' , $ quote ->getCustomerEmail ());
88
96
}
89
97
90
- public function testUpdateCustomerData ()
98
+ /**
99
+ * @return void
100
+ */
101
+ public function testUpdateCustomerData (): void
91
102
{
92
103
/** @var Quote $quote */
93
104
$ quote = $ this ->objectManager ->create (Quote::class);
@@ -133,8 +144,10 @@ public function testUpdateCustomerData()
133
144
134
145
/**
135
146
* Customer data is set to quote (which contains valid group ID).
147
+ *
148
+ * @return void
136
149
*/
137
- public function testGetCustomerGroupFromCustomer ()
150
+ public function testGetCustomerGroupFromCustomer (): void
138
151
{
139
152
/** Preconditions */
140
153
/** @var CustomerInterfaceFactory $customerFactory */
@@ -154,8 +167,9 @@ public function testGetCustomerGroupFromCustomer()
154
167
155
168
/**
156
169
* @magentoDataFixture Magento/Customer/_files/customer_group.php
170
+ * @return void
157
171
*/
158
- public function testGetCustomerTaxClassId ()
172
+ public function testGetCustomerTaxClassId (): void
159
173
{
160
174
/**
161
175
* Preconditions: create quote and assign ID of customer group created in fixture to it.
@@ -179,8 +193,9 @@ public function testGetCustomerTaxClassId()
179
193
* @magentoDataFixture Magento/Customer/_files/customer.php
180
194
* @magentoDataFixture Magento/Customer/_files/customer_address.php
181
195
* @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
196
+ * @return void
182
197
*/
183
- public function testAssignCustomerWithAddressChangeAddressesNotSpecified ()
198
+ public function testAssignCustomerWithAddressChangeAddressesNotSpecified (): void
184
199
{
185
200
/** Preconditions:
186
201
* Customer with two addresses created
@@ -244,8 +259,9 @@ public function testAssignCustomerWithAddressChangeAddressesNotSpecified()
244
259
* @magentoDataFixture Magento/Customer/_files/customer.php
245
260
* @magentoDataFixture Magento/Customer/_files/customer_address.php
246
261
* @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
262
+ * @return void
247
263
*/
248
- public function testAssignCustomerWithAddressChange ()
264
+ public function testAssignCustomerWithAddressChange (): void
249
265
{
250
266
/** Preconditions:
251
267
* Customer with two addresses created
@@ -308,8 +324,9 @@ public function testAssignCustomerWithAddressChange()
308
324
309
325
/**
310
326
* @magentoDataFixture Magento/Catalog/_files/product_simple_duplicated.php
327
+ * @return void
311
328
*/
312
- public function testAddProductUpdateItem ()
329
+ public function testAddProductUpdateItem (): void
313
330
{
314
331
/** @var Quote $quote */
315
332
$ quote = $ this ->objectManager ->create (Quote::class);
@@ -353,10 +370,13 @@ public function testAddProductUpdateItem()
353
370
* @param Quote $quote
354
371
* @return \Magento\Customer\Api\Data\CustomerInterface
355
372
*/
356
- protected function _prepareQuoteForTestAssignCustomerWithAddressChange ($ quote )
357
- {
373
+ protected function _prepareQuoteForTestAssignCustomerWithAddressChange (
374
+ Quote $ quote
375
+ ): \Magento \Customer \Api \Data \CustomerInterface {
358
376
/** @var \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository */
359
- $ customerRepository = $ this ->objectManager ->create (\Magento \Customer \Api \CustomerRepositoryInterface::class);
377
+ $ customerRepository = $ this ->objectManager ->create (
378
+ \Magento \Customer \Api \CustomerRepositoryInterface::class
379
+ );
360
380
$ fixtureCustomerId = 1 ;
361
381
/** @var \Magento\Customer\Model\Customer $customer */
362
382
$ customer = $ this ->objectManager ->create (\Magento \Customer \Model \Customer::class);
@@ -375,11 +395,11 @@ protected function _prepareQuoteForTestAssignCustomerWithAddressChange($quote)
375
395
}
376
396
377
397
/**
378
- * @param $email
398
+ * @param string $email
379
399
* @param array $customerData
380
400
* @return array
381
401
*/
382
- protected function changeEmailInCustomerData ($ email , array $ customerData )
402
+ protected function changeEmailInCustomerData (string $ email , array $ customerData ): array
383
403
{
384
404
$ customerData [\Magento \Customer \Model \Data \Customer::EMAIL ] = $ email ;
385
405
return $ customerData ;
@@ -389,13 +409,16 @@ protected function changeEmailInCustomerData($email, array $customerData)
389
409
* @param array $customerData
390
410
* @return array
391
411
*/
392
- protected function removeIdFromCustomerData (array $ customerData )
412
+ protected function removeIdFromCustomerData (array $ customerData ): array
393
413
{
394
414
unset($ customerData [\Magento \Customer \Model \Data \Customer::ID ]);
395
415
return $ customerData ;
396
416
}
397
417
398
- protected function _getCustomerDataArray ()
418
+ /**
419
+ * @return array
420
+ */
421
+ protected function _getCustomerDataArray (): array
399
422
{
400
423
return [
401
424
\Magento \Customer \Model \Data \Customer::CONFIRMATION => 'test ' ,
@@ -425,8 +448,9 @@ protected function _getCustomerDataArray()
425
448
*
426
449
* @magentoDataFixture Magento/Sales/_files/order.php
427
450
* @magentoDataFixture Magento/Quote/_files/empty_quote.php
451
+ * @return void
428
452
*/
429
- public function testReserveOrderId ()
453
+ public function testReserveOrderId (): void
430
454
{
431
455
/** @var Quote $quote */
432
456
$ quote = $ this ->objectManager ->create (Quote::class);
@@ -441,8 +465,9 @@ public function testReserveOrderId()
441
465
/**
442
466
* Test to verify that disabled product cannot be added to cart
443
467
* @magentoDataFixture Magento/Quote/_files/is_not_salable_product.php
468
+ * @return void
444
469
*/
445
- public function testAddedProductToQuoteIsSalable ()
470
+ public function testAddedProductToQuoteIsSalable (): void
446
471
{
447
472
$ productId = 99 ;
448
473
@@ -462,8 +487,9 @@ public function testAddedProductToQuoteIsSalable()
462
487
/**
463
488
* @magentoDataFixture Magento/Sales/_files/quote.php
464
489
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
490
+ * @return void
465
491
*/
466
- public function testGetItemById ()
492
+ public function testGetItemById (): void
467
493
{
468
494
$ quote = $ this ->objectManager ->create (Quote::class);
469
495
$ quote ->load ('test01 ' , 'reserved_order_id ' );
@@ -485,8 +511,9 @@ public function testGetItemById()
485
511
* Tests of quotes merging.
486
512
*
487
513
* @magentoDataFixture Magento/Sales/_files/quote.php
514
+ * @return void
488
515
*/
489
- public function testMerge ()
516
+ public function testMerge (): void
490
517
{
491
518
$ giftMessageId = 1 ;
492
519
@@ -507,7 +534,7 @@ public function testMerge()
507
534
* @param string $reservedOrderId
508
535
* @return Quote
509
536
*/
510
- private function getQuote ($ reservedOrderId )
537
+ private function getQuote (string $ reservedOrderId ): Quote
511
538
{
512
539
/** @var SearchCriteriaBuilder $searchCriteriaBuilder */
513
540
$ searchCriteriaBuilder = $ this ->objectManager ->get (SearchCriteriaBuilder::class);
0 commit comments