13
13
use Magento \Quote \Model \QuoteFactory ;
14
14
use Magento \Quote \Model \QuoteIdToMaskedQuoteIdInterface ;
15
15
use Magento \Quote \Model \ResourceModel \Quote as QuoteResource ;
16
+ use Magento \QuoteGraphQl \Model \GetMaskedQuoteIdByReversedQuoteId ;
16
17
use Magento \TestFramework \Helper \Bootstrap ;
17
18
use Magento \TestFramework \TestCase \GraphQlAbstract ;
18
19
use Magento \TestFramework \ObjectManager ;
@@ -37,6 +38,11 @@ class SetShippingAddressOnCartTest extends GraphQlAbstract
37
38
*/
38
39
private $ quoteIdToMaskedId ;
39
40
41
+ /**
42
+ * @var GetMaskedQuoteIdByReversedQuoteId
43
+ */
44
+ private $ getMaskedQuoteIdByReversedQuoteId ;
45
+
40
46
/**
41
47
* @var CustomerTokenServiceInterface
42
48
*/
@@ -47,16 +53,20 @@ protected function setUp()
47
53
$ objectManager = Bootstrap::getObjectManager ();
48
54
$ this ->quoteResource = $ objectManager ->get (QuoteResource::class);
49
55
$ this ->quoteFactory = $ objectManager ->get (QuoteFactory::class);
56
+ $ this ->getMaskedQuoteIdByReversedQuoteId = $ objectManager ->get (GetMaskedQuoteIdByReversedQuoteId::class);
50
57
$ this ->quoteIdToMaskedId = $ objectManager ->get (QuoteIdToMaskedQuoteIdInterface::class);
51
58
$ this ->customerTokenService = $ objectManager ->get (CustomerTokenServiceInterface::class);
52
59
}
53
60
54
61
/**
55
62
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
63
+ *
64
+ * @throws \Exception
65
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
56
66
*/
57
67
public function testSetNewShippingAddressByGuest ()
58
68
{
59
- $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId ('test_order_with_simple_product_without_address ' );
69
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId -> execute ('test_order_with_simple_product_without_address ' );
60
70
61
71
$ query = <<<QUERY
62
72
mutation {
@@ -116,7 +126,7 @@ public function testSetNewShippingAddressByGuest()
116
126
*/
117
127
public function testSetShippingAddressFromAddressBookByGuest ()
118
128
{
119
- $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId ('test_order_with_simple_product_without_address ' );
129
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId -> execute ('test_order_with_simple_product_without_address ' );
120
130
121
131
$ query = <<<QUERY
122
132
mutation {
@@ -284,7 +294,7 @@ public function testSetNotExistedShippingAddressFromAddressBook()
284
294
*/
285
295
public function testSetShippingAddressWithoutAddresses ()
286
296
{
287
- $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId ('test_order_with_simple_product_without_address ' );
297
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId -> execute ('test_order_with_simple_product_without_address ' );
288
298
289
299
$ query = <<<QUERY
290
300
mutation {
@@ -361,7 +371,7 @@ public function testSetNewShippingAddressAndFromAddressBookAtSameTime()
361
371
*/
362
372
public function testSetMultipleNewShippingAddresses ()
363
373
{
364
- $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId ('test_order_with_simple_product_without_address ' );
374
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReversedQuoteId -> execute ('test_order_with_simple_product_without_address ' );
365
375
366
376
$ query = <<<QUERY
367
377
mutation {
@@ -512,18 +522,6 @@ private function getHeaderMap(string $username = '
[email protected] ', string
512
522
return $ headerMap ;
513
523
}
514
524
515
- /**
516
- * @param string $reversedQuoteId
517
- * @return string
518
- */
519
- private function getMaskedQuoteIdByReversedQuoteId (string $ reversedQuoteId ): string
520
- {
521
- $ quote = $ this ->quoteFactory ->create ();
522
- $ this ->quoteResource ->load ($ quote , $ reversedQuoteId , 'reserved_order_id ' );
523
-
524
- return $ this ->quoteIdToMaskedId ->execute ((int )$ quote ->getId ());
525
- }
526
-
527
525
/**
528
526
* @param string $reversedQuoteId
529
527
* @param int $customerId
0 commit comments