Skip to content

Commit 7aa3eec

Browse files
ACPT-1552: Clean up skip-list for GraphQlState Test
1 parent fcaec4c commit 7aa3eec

File tree

23 files changed

+192
-172
lines changed

23 files changed

+192
-172
lines changed

app/code/Magento/BundleGraphQl/Model/Cart/BuyRequest/BundleDataProvider.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
namespace Magento\BundleGraphQl\Model\Cart\BuyRequest;
99

10+
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\Stdlib\ArrayManager;
12+
use Magento\Framework\Stdlib\ArrayManagerFactory;
1113
use Magento\QuoteGraphQl\Model\Cart\BuyRequest\BuyRequestDataProviderInterface;
1214

1315
/**
@@ -16,26 +18,30 @@
1618
class BundleDataProvider implements BuyRequestDataProviderInterface
1719
{
1820
/**
19-
* @var ArrayManager
21+
* @var ArrayManagerFactory
2022
*/
21-
private $arrayManager;
23+
private readonly ArrayManagerFactory $arrayManagerFactory;
2224

2325
/**
24-
* @param ArrayManager $arrayManager
26+
* @param ArrayManager $arrayManager @deprecated @see $arrayManagerFactory
27+
* @param ArrayManagerFactory|null $arrayManagerFactory
2528
*/
2629
public function __construct(
27-
ArrayManager $arrayManager
30+
ArrayManager $arrayManager,
31+
?ArrayManagerFactory $arrayManagerFactory = null,
2832
) {
29-
$this->arrayManager = $arrayManager;
33+
$this->arrayManagerFactory = $arrayManagerFactory
34+
?? ObjectManager::getInstance()->get(ArrayManagerFactory::class);
3035
}
3136

37+
3238
/**
3339
* @inheritdoc
3440
*/
3541
public function execute(array $cartItemData): array
3642
{
3743
$bundleOptions = [];
38-
$bundleInputs = $this->arrayManager->get('bundle_options', $cartItemData) ?? [];
44+
$bundleInputs = $this->arrayManagerFactory->create()->get('bundle_options', $cartItemData) ?? [];
3945
foreach ($bundleInputs as $bundleInput) {
4046
$bundleOptions['bundle_option'][$bundleInput['id']] = $bundleInput['value'];
4147
$bundleOptions['bundle_option_qty'][$bundleInput['id']] = $bundleInput['quantity'];

app/code/Magento/ConfigurableProductGraphQl/Model/Cart/BuyRequest/SuperAttributeDataProvider.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
use Magento\CatalogInventory\Api\StockStateInterface;
1313
use Magento\CatalogInventory\Model\StockStateException;
1414
use Magento\ConfigurableProductGraphQl\Model\Options\Collection as OptionCollection;
15+
use Magento\Framework\App\ObjectManager;
1516
use Magento\Framework\EntityManager\MetadataPool;
1617
use Magento\Framework\Exception\LocalizedException;
1718
use Magento\Framework\Exception\NoSuchEntityException;
1819
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1920
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
2021
use Magento\Framework\Stdlib\ArrayManager;
22+
use Magento\Framework\Stdlib\ArrayManagerFactory;
2123
use Magento\Quote\Model\Quote;
2224
use Magento\QuoteGraphQl\Model\Cart\BuyRequest\BuyRequestDataProviderInterface;
2325

@@ -27,9 +29,9 @@
2729
class SuperAttributeDataProvider implements BuyRequestDataProviderInterface
2830
{
2931
/**
30-
* @var ArrayManager
32+
* @var ArrayManagerFactory
3133
*/
32-
private $arrayManager;
34+
private readonly ArrayManagerFactory $arrayManagerFactory;
3335

3436
/**
3537
* @var ProductRepositoryInterface
@@ -52,20 +54,23 @@ class SuperAttributeDataProvider implements BuyRequestDataProviderInterface
5254
private $stockState;
5355

5456
/**
55-
* @param ArrayManager $arrayManager
57+
* @param ArrayManager $arrayManager @deprecated @see $arrayManagerFactory
5658
* @param ProductRepositoryInterface $productRepository
5759
* @param OptionCollection $optionCollection
5860
* @param MetadataPool $metadataPool
5961
* @param StockStateInterface $stockState
62+
* @param ArrayManagerFactory|null $arrayManagerFactory
6063
*/
6164
public function __construct(
6265
ArrayManager $arrayManager,
6366
ProductRepositoryInterface $productRepository,
6467
OptionCollection $optionCollection,
6568
MetadataPool $metadataPool,
66-
StockStateInterface $stockState
69+
StockStateInterface $stockState,
70+
?ArrayManagerFactory $arrayManagerFactory = null,
6771
) {
68-
$this->arrayManager = $arrayManager;
72+
$this->arrayManagerFactory = $arrayManagerFactory
73+
?? ObjectManager::getInstance()->get(ArrayManagerFactory::class);
6974
$this->productRepository = $productRepository;
7075
$this->optionCollection = $optionCollection;
7176
$this->metadataPool = $metadataPool;
@@ -77,13 +82,13 @@ public function __construct(
7782
*/
7883
public function execute(array $cartItemData): array
7984
{
80-
$parentSku = $this->arrayManager->get('parent_sku', $cartItemData);
85+
$parentSku = $this->arrayManagerFactory->create()->get('parent_sku', $cartItemData);
8186
if ($parentSku === null) {
8287
return [];
8388
}
84-
$sku = $this->arrayManager->get('data/sku', $cartItemData);
85-
$qty = $this->arrayManager->get('data/quantity', $cartItemData);
86-
$cart = $this->arrayManager->get('model', $cartItemData);
89+
$sku = $this->arrayManagerFactory->create()->get('data/sku', $cartItemData);
90+
$qty = $this->arrayManagerFactory->create()->get('data/quantity', $cartItemData);
91+
$cart = $this->arrayManagerFactory->create()->get('model', $cartItemData);
8792
if (!$cart instanceof Quote) {
8893
throw new LocalizedException(__('"model" value should be specified'));
8994
}

app/code/Magento/PaypalGraphQl/Model/PayflowProAdditionalDataProvider.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,12 @@
1616
*/
1717
class PayflowProAdditionalDataProvider implements AdditionalDataProviderInterface
1818
{
19-
20-
/**
21-
* @var ArrayManager
22-
*/
23-
private $arrayManager;
24-
2519
/**
2620
* @param ArrayManager $arrayManager
2721
*/
2822
public function __construct(
2923
ArrayManager $arrayManager
3024
) {
31-
$this->arrayManager = $arrayManager;
3225
}
3326

3427
/**

app/code/Magento/PaypalGraphQl/Model/PayflowProCcVaultAdditionalDataProvider.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,12 @@ class PayflowProCcVaultAdditionalDataProvider implements AdditionalDataProviderI
1717
{
1818
const CC_VAULT_CODE = 'payflowpro_cc_vault';
1919

20-
/**
21-
* @var ArrayManager
22-
*/
23-
private $arrayManager;
24-
2520
/**
2621
* @param ArrayManager $arrayManager
2722
*/
2823
public function __construct(
2924
ArrayManager $arrayManager
3025
) {
31-
$this->arrayManager = $arrayManager;
3226
}
3327

3428
/**

app/code/Magento/PaypalGraphQl/Model/Plugin/Resolver/SetPaymentMethodOnCart.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77

88
namespace Magento\PaypalGraphQl\Model\Plugin\Resolver;
99

10+
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\Exception\LocalizedException;
1112
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1213
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
1314
use Magento\Framework\GraphQl\Query\ResolverInterface;
1415
use Magento\Framework\GraphQl\Config\Element\Field;
1516
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
17+
use Magento\Framework\Stdlib\ArrayManagerFactory;
1618
use Magento\Paypal\Model\Express\Checkout\Factory as CheckoutFactory;
1719
use Magento\Framework\Stdlib\ArrayManager;
1820
use Magento\PaypalGraphQl\Model\Provider\Checkout as CheckoutProvider;
@@ -35,9 +37,9 @@ class SetPaymentMethodOnCart
3537
private $checkoutFactory;
3638

3739
/**
38-
* @var ArrayManager
40+
* @var ArrayManagerFactory
3941
*/
40-
private $arrayManager;
42+
private readonly ArrayManagerFactory $arrayManagerFactory;
4143

4244
/**
4345
* @var CheckoutProvider
@@ -51,20 +53,23 @@ class SetPaymentMethodOnCart
5153

5254
/**
5355
* @param CheckoutFactory $checkoutFactory
54-
* @param ArrayManager $arrayManager
56+
* @param ArrayManager $arrayManager @deprecated @see $arrayManagerFactory
5557
* @param CheckoutProvider $checkoutProvider
5658
* @param ConfigProvider $configProvider
5759
* @param array $allowedPaymentMethodCodes
60+
* @param ArrayManagerFactory|null $arrayManagerFactory
5861
*/
5962
public function __construct(
6063
CheckoutFactory $checkoutFactory,
6164
ArrayManager $arrayManager,
6265
CheckoutProvider $checkoutProvider,
6366
ConfigProvider $configProvider,
64-
array $allowedPaymentMethodCodes = []
67+
array $allowedPaymentMethodCodes = [],
68+
?ArrayManagerFactory $arrayManagerFactory = null,
6569
) {
6670
$this->checkoutFactory = $checkoutFactory;
67-
$this->arrayManager = $arrayManager;
71+
$this->arrayManagerFactory = $arrayManagerFactory
72+
?? ObjectManager::getInstance()->get(ArrayManagerFactory::class);
6873
$this->checkoutProvider = $checkoutProvider;
6974
$this->configProvider = $configProvider;
7075
$this->allowedPaymentMethodCodes = $allowedPaymentMethodCodes;
@@ -93,12 +98,11 @@ public function afterResolve(
9398
array $value = null,
9499
array $args = null
95100
) {
96-
$paymentCode = $this->arrayManager->get(self::PATH_CODE, $args) ?? '';
101+
$paymentCode = $this->arrayManagerFactory->create()->get(self::PATH_CODE, $args) ?? '';
97102
if (!$this->isAllowedPaymentMethod($paymentCode)) {
98103
return $resolvedValue;
99104
}
100-
101-
$paypalAdditionalData = $this->arrayManager->get(self::PATH_PAYMENT_METHOD_DATA, $args) ?? [];
105+
$paypalAdditionalData = $this->arrayManagerFactory->create()->get(self::PATH_PAYMENT_METHOD_DATA, $args) ?? [];
102106
$payerId = $paypalAdditionalData[$paymentCode]['payer_id'] ?? null;
103107
$token = $paypalAdditionalData[$paymentCode]['token'] ?? null;
104108
$cart = $resolvedValue['cart']['model'];

app/code/Magento/QuoteGraphQl/Model/Cart/BuyRequest/CustomizableOptionsDataProvider.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,37 @@
77

88
namespace Magento\QuoteGraphQl\Model\Cart\BuyRequest;
99

10+
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\Stdlib\ArrayManager;
12+
use Magento\Framework\Stdlib\ArrayManagerFactory;
1113

1214
/**
1315
* Extract buy request elements require for custom options
1416
*/
1517
class CustomizableOptionsDataProvider implements BuyRequestDataProviderInterface
1618
{
1719
/**
18-
* @var ArrayManager
20+
* @var ArrayManagerFactory
1921
*/
20-
private $arrayManager;
22+
private readonly ArrayManagerFactory $arrayManagerFactory;
2123

2224
/**
23-
* @param ArrayManager $arrayManager
25+
* @param ArrayManager $arrayManager @deprecated @see $arrayManagerFactory
26+
* @param ArrayManagerFactory|null $arrayManagerFactory
2427
*/
2528
public function __construct(
2629
ArrayManager $arrayManager
2730
) {
28-
$this->arrayManager = $arrayManager;
31+
$this->arrayManagerFactory = $arrayManagerFactory
32+
?? ObjectManager::getInstance()->get(ArrayManagerFactory::class);
2933
}
3034

3135
/**
3236
* @inheritdoc
3337
*/
3438
public function execute(array $cartItemData): array
3539
{
36-
$customizableOptions = $this->arrayManager->get('customizable_options', $cartItemData, []);
37-
40+
$customizableOptions = $this->arrayManagerFactory->create()->get('customizable_options', $cartItemData, []);
3841
$customizableOptionsData = [];
3942
foreach ($customizableOptions as $customizableOption) {
4043
if (isset($customizableOption['value_string'])) {
@@ -43,7 +46,6 @@ public function execute(array $cartItemData): array
4346
);
4447
}
4548
}
46-
4749
return ['options' => $customizableOptionsData];
4850
}
4951

app/code/Magento/QuoteGraphQl/Model/Cart/BuyRequest/QuantityDataProvider.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,39 @@
77

88
namespace Magento\QuoteGraphQl\Model\Cart\BuyRequest;
99

10+
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1112
use Magento\Framework\Stdlib\ArrayManager;
13+
use Magento\Framework\Stdlib\ArrayManagerFactory;
1214

1315
/**
1416
* Provides QTY buy request data for adding products to cart
1517
*/
1618
class QuantityDataProvider implements BuyRequestDataProviderInterface
1719
{
1820
/**
19-
* @var ArrayManager
21+
* @var ArrayManagerFactory
2022
*/
21-
private $arrayManager;
23+
private readonly ArrayManagerFactory $arrayManagerFactory;
2224

2325
/**
24-
* @param ArrayManager $arrayManager
26+
* @param ArrayManager $arrayManager @deprecated @see $arrayManagerFactory
27+
* @param ArrayManagerFactory|null $arrayManagerFactory
2528
*/
2629
public function __construct(
27-
ArrayManager $arrayManager
30+
ArrayManager $arrayManager,
31+
?ArrayManagerFactory $arrayManagerFactory = null,
2832
) {
29-
$this->arrayManager = $arrayManager;
33+
$this->arrayManagerFactory = $arrayManagerFactory
34+
?? ObjectManager::getInstance()->get(ArrayManagerFactory::class);
3035
}
3136

3237
/**
3338
* @inheritdoc
3439
*/
3540
public function execute(array $cartItemData): array
3641
{
37-
$quantity = $this->arrayManager->get('data/quantity', $cartItemData);
42+
$quantity = $this->arrayManagerFactory->create()->get('data/quantity', $cartItemData);
3843
if (!isset($quantity)) {
3944
throw new GraphQlInputException(__('Missing key "quantity" in cart item data'));
4045
}

app/code/Magento/Sales/Model/Order/Email/Container/Container.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Sales\Model\Order\Email\Container;
77

88
use Magento\Framework\App\Config\ScopeConfigInterface;
9+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
910
use Magento\Store\Model\Store;
1011
use Magento\Store\Model\StoreManagerInterface;
1112

@@ -15,7 +16,7 @@
1516
* @api
1617
* @since 100.0.2
1718
*/
18-
abstract class Container implements IdentityInterface
19+
abstract class Container implements IdentityInterface, ResetAfterRequestInterface
1920
{
2021
/**
2122
* @var StoreManagerInterface
@@ -138,4 +139,13 @@ public function getCustomerEmail()
138139
{
139140
return $this->customerEmail;
140141
}
142+
143+
/**
144+
* @inheritDoc
145+
*/
146+
public function _resetState(): void
147+
{
148+
$this->customerEmail = null;
149+
$this->customerName = null;
150+
}
141151
}

app/code/Magento/Sales/Model/Order/Email/Container/Template.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
*/
66
namespace Magento\Sales\Model\Order\Email\Container;
77

8-
class Template
8+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
9+
10+
class Template implements ResetAfterRequestInterface
911
{
1012
/**
1113
* @var array
@@ -89,4 +91,15 @@ public function getTemplateId()
8991
{
9092
return $this->id;
9193
}
94+
95+
/**
96+
* @inheritDoc
97+
*/
98+
public function _resetState(): void
99+
{
100+
$this->vars = null;
101+
$this->options = null;
102+
$this->id = null;
103+
$this->templateId = null;
104+
}
92105
}

0 commit comments

Comments
 (0)