Skip to content

Commit 0944abf

Browse files
ACPT-1552 WIP
1 parent a0f1df4 commit 0944abf

File tree

4 files changed

+32
-71
lines changed

4 files changed

+32
-71
lines changed

app/code/Magento/Catalog/Model/Category/AttributeRepository.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
namespace Magento\Catalog\Model\Category;
77

88
use Magento\Catalog\Api\CategoryAttributeRepositoryInterface;
9+
use Magento\Framework\App\State\ReloadProcessorInterface;
910

10-
class AttributeRepository implements CategoryAttributeRepositoryInterface
11+
class AttributeRepository implements CategoryAttributeRepositoryInterface, ReloadProcessorInterface
1112
{
1213
/**
1314
* @var \Magento\Framework\Api\SearchCriteriaBuilder
@@ -30,7 +31,7 @@ class AttributeRepository implements CategoryAttributeRepositoryInterface
3031
private $eavConfig;
3132

3233
/**
33-
* @var array
34+
* @var array|null
3435
*/
3536
private $metadataCache;
3637

@@ -98,4 +99,14 @@ public function getCustomAttributesMetadata($dataObjectClassName = null)
9899
}
99100
return $this->metadataCache[$dataObjectClassName];
100101
}
102+
103+
/**
104+
* @inheritDoc
105+
*/
106+
public function reloadState(): void
107+
{
108+
$this->filterBuilder->_resetState();
109+
$this->searchCriteriaBuilder->_resetState();
110+
$this->metadataCache = null;
111+
}
101112
}

app/code/Magento/Catalog/etc/di.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,4 +1344,11 @@
13441344
</argument>
13451345
</arguments>
13461346
</type>
1347+
<type name="Magento\Framework\App\State\ReloadProcessorComposite">
1348+
<arguments>
1349+
<argument name="processors" xsi:type="array">
1350+
<item name="Magento_Catalog::AttributeRepository" xsi:type="object">Magento\Catalog\Model\Category\AttributeRepository</item>
1351+
</argument>
1352+
</arguments>
1353+
</type>
13471354
</config>

lib/internal/Magento/Framework/Search/Request/Cleaner.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,30 @@
77
namespace Magento\Framework\Search\Request;
88

99
use Magento\Framework\Exception\StateException;
10+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1011
use Magento\Framework\Search\Request\Aggregation\StatusInterface as AggregationStatus;
1112
use Magento\Framework\Phrase;
1213

1314
/**
1415
* @api
1516
* @since 100.0.2
1617
*/
17-
class Cleaner
18+
class Cleaner implements ResetAfterRequestInterface
1819
{
1920
/**
2021
* @var array
2122
*/
22-
private $requestData;
23+
private $requestData = [];
2324

2425
/**
2526
* @var array
2627
*/
27-
private $mappedQueries;
28+
private $mappedQueries = [];
2829

2930
/**
3031
* @var array
3132
*/
32-
private $mappedFilters;
33+
private $mappedFilters = [];
3334

3435
/**
3536
* @var AggregationStatus
@@ -261,4 +262,9 @@ private function clear()
261262
$this->mappedFilters = [];
262263
$this->requestData = [];
263264
}
265+
266+
public function _resetState(): void
267+
{
268+
$this->clear();
269+
}
264270
}

lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/_files/state-skip-list.php

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
/* These classes are skipped completely during comparison. */
99
return [
1010
'*' => [
11-
// list of the latest failures started
1211
Magento\Sales\Api\Data\ShippingAssignmentInterfaceFactory::class => null,
1312
Magento\Sales\Model\Order\ShippingBuilderFactory::class => null,
1413
Magento\Sales\Model\Order\ShippingAssignmentBuilder::class => null,
15-
// list of the latest failures ended
1614
Magento\Framework\Translate\Inline::class => null,
1715
Magento\Framework\Json\Encoder::class => null,
1816
Magento\Framework\Lock\Proxy::class => null,
@@ -181,7 +179,6 @@
181179
Magento\Customer\Model\Plugin\CustomerFlushFormKey::class => null,
182180
Magento\Customer\Observer\LogLastLoginAtObserver::class => null,
183181
Magento\Customer\Model\Visitor\Proxy::class => null,
184-
// Magento\Customer\Observer\LogLastLoginAtObserver::class => null,
185182
Magento\Customer\Api\CustomerRepositoryInterface\Proxy::class => null,
186183
Magento\Customer\Model\ResourceModel\Attribute::class => null,
187184
Magento\Customer\Model\Address\Config::class => null,
@@ -211,7 +208,6 @@
211208
Magento\InventoryConfigurableProduct\Pricing\Price\Indexer\OptionsIndexer::class => null,
212209
Magento\InventoryCatalog\Plugin\CatalogInventory\Model\Indexer\ModifySelectInProductPriceIndexFilter::class => null,
213210
Magento\Indexer\Model\Indexer\DeferCacheCleaning::class => null,
214-
215211
Magento\LoginAsCustomerAssistance\Model\IsAssistanceEnabled::class => null,
216212
Magento\LoginAsCustomerAssistance\Model\SetAssistance::class => null,
217213
Magento\LoginAsCustomerAssistance\Plugin\CustomerPlugin::class => null,
@@ -254,7 +250,6 @@
254250
Magento\Directory\Helper\Data::class => null,
255251
Magento\Store\Model\Address\Renderer::class => null,
256252
Magento\QuoteGraphQl\Plugin\ProductAttributesExtender::class => null,
257-
258253
Magento\Paypal\Plugin\TransparentSessionChecker::class => null,
259254
Magento\Backend\App\Area\FrontNameResolver::class => null,
260255
Magento\Backend\Helper\Data::class => null,
@@ -269,13 +264,10 @@
269264
Magento\CustomerGraphQl\Model\Customer\ValidateCustomerData\ValidateEmail::class => null,
270265
Magento\CustomerGraphQl\Model\Customer\ValidateCustomerData::class => null,
271266
Magento\Catalog\Helper\Data::class => null,
272-
273267
Magento\Eav\Model\AttributeDataFactory::class => null,
274268
Magento\Checkout\Model\Session::class => null,
275-
276269
Magento\JwtUserToken\Model\ConfigurableJwtSettingsProvider::class => null,
277270
Magento\JwtUserToken\Model\Reader::class => null,
278-
279271
Magento\Bundle\Pricing\Price\TaxPrice::class => null,
280272
Magento\Customer\Observer\AfterAddressSaveObserver::class => null,
281273
Magento\LoginAsCustomer\Model\GetLoggedAsCustomerAdminId::class => null,
@@ -325,7 +317,6 @@
325317
Magento\Framework\Interception\PluginList\PluginList::class => null,
326318
Magento\InventorySales\Model\IsProductSalableForRequestedQtyCondition\IsProductSalableForRequestedQtyConditionChain::class => null,
327319
Magento\InventorySales\Model\AreProductsSalableForRequestedQty::class => null,
328-
// Magento\Customer\Model\GroupRegistry::class => null,
329320
Magento\Config\App\Config\Type\System::class => null,
330321
Magento\CatalogRule\Observer\RulePricesStorage::class => null,
331322
Magento\CatalogRule\Observer\PrepareCatalogProductCollectionPricesObserver::class => null,
@@ -347,7 +338,6 @@
347338
Magento\Quote\Model\Quote\Relation::class => null,
348339
Magento\Quote\Model\QueryResolver::class => null,
349340
'QuoteRelationsComposite' => null,
350-
// Magento\GraphQlCache\Model\Plugin\Auth\TokenIssuer::class => null,
351341
Magento\StoreGraphQl\Plugin\LocalizeEmail::class => null,
352342
],
353343
'*-fromConstructed' => [
@@ -359,15 +349,12 @@
359349
Magento\PageBuilder\Model\Filter\Template::class => null,
360350
Magento\PageBuilder\Plugin\Filter\TemplatePlugin::class => null,
361351
Magento\Customer\Api\Data\CustomerExtension::class => null,
362-
// Magento\Framework\Css\PreProcessor\Adapter\CssInliner::class => null,
363352
Magento\Framework\TestFramework\ApplicationStateComparator\ObjectManager::class => null,
364353
Magento\RemoteStorage\Filesystem::class => null,
365354
Magento\Framework\App\Cache\Frontend\Factory::class => null,
366-
// Magento\Framework\Config\Scope::class => null,
367355
Magento\TestFramework\ObjectManager\Config::class => null,
368356
Magento\Framework\ObjectManager\Definition\Runtime::class => null,
369357
Magento\Framework\Cache\LockGuardedCacheLoader::class => null,
370-
// Magento\Config\App\Config\Type\System::class => null,
371358
Magento\Framework\View\Asset\PreProcessor\Pool::class => null,
372359
Magento\Framework\App\Area::class => null,
373360
Magento\Store\Model\Store\Interceptor::class => null,
@@ -376,27 +363,17 @@
376363
null, // TODO: Do we need to add a reset for when config changes? Adding it now. Need to add to di.xml
377364
Magento\Framework\App\Http\Context\Interceptor::class => null,
378365
Magento\Framework\HTTP\LaminasClient::class => null,
379-
// Magento\Customer\Model\GroupRegistry::class =>
380-
// null, // FIXME: This looks like it needs _resetState or else it would be bug
381-
// Magento\Framework\Model\ResourceModel\Db\VersionControl\Metadata::class => null,
382-
// Magento\Framework\App\DeploymentConfig::class => null,
383-
// Laminas\Uri\Uri::class => null,
384-
// Magento\Framework\App\Cache\Frontend\Pool::class => null,
385366
Magento\TestFramework\App\State\Interceptor::class => null,
386367
Magento\TestFramework\App\MutableScopeConfig::class => null,
387368
Magento\TestFramework\Store\StoreManager::class => null,
388369
Magento\TestFramework\Workaround\Override\Config\RelationsCollector::class => null,
389-
// Magento\Framework\Reflection\MethodsMap::class => null,
390370
Magento\Framework\Session\SaveHandler::class => null,
391-
// Magento\Customer\Model\GroupRegistry::class => null, // FIXME: Needs _resetState for $registry
392371
Magento\Customer\Model\Group\Interceptor::class => null,
393372
Magento\Store\Model\Group\Interceptor::class => null,
394373
Magento\Directory\Model\Currency\Interceptor::class => null,
395374
Magento\Theme\Model\Theme\ThemeProvider::class => null, // Needs _resetState for themes
396-
// Magento\Theme\Model\View\Design::class => null,
397-
Magento\Catalog\Model\Category\AttributeRepository::class =>
398-
null, // FIXME: Needs resetState OR reset when poison pill triggered.
399-
Magento\Framework\Search\Request\Cleaner::class => null, // FIXME: Needs resetState
375+
Magento\Catalog\Model\Category\AttributeRepository::class => null, // Note: has reloadState
376+
// Magento\Framework\Search\Request\Cleaner::class => null, // FIXME: Needs resetState
400377
Magento\Catalog\Model\ResourceModel\Category\Interceptor::class => null,
401378
Magento\Catalog\Model\Attribute\Backend\DefaultBackend\Interceptor::class => null,
402379
Magento\GraphQlCache\Model\Resolver\IdentityPool::class => null,
@@ -433,7 +410,6 @@
433410
Magento\Framework\View\Asset\File::class => null,
434411
Magento\Customer\Model\Attribute\Interceptor::class => null,
435412
Magento\Framework\GraphQl\Schema\SchemaGenerator::class => null,
436-
// Magento\Customer\Model\ResourceModel\Customer::class => null,
437413
Magento\Framework\App\PageCache\Version::class => null,
438414
Magento\Framework\App\PageCache\Identifier::class => null,
439415
Magento\Framework\App\PageCache\Kernel::class => null,
@@ -449,11 +425,9 @@
449425
Magento\Catalog\Model\Product\Type\Simple\Interceptor::class => null,
450426
Magento\Customer\Model\Session\Storage::class =>
451427
null, // FIXME: race condition with Magento\Customer\Model\Session::_resetState()
452-
// Magento\Framework\Module\Manager::class => null,
453428
Magento\Eav\Api\Data\AttributeExtension::class
454429
=> null, // FIXME: This needs to be fixed. is_pagebuilder_enabled 0 => null
455430
Magento\TestFramework\Event\Magento::class => null,
456-
// Magento\Webapi\Model\Authorization\TokenUserContext::class => null, // Has good _resetState
457431
Magento\Store\Model\Website\Interceptor::class => null, // reset by poison pill
458432
Magento\Eav\Model\Entity\Type::class => null, // attribute types should be destroyed by poison pill
459433
Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend\Interceptor::class =>
@@ -476,8 +450,6 @@
476450
Magento\Config\Model\Config\Structure\Data::class => null, // should be cleaned after poison pill
477451
Magento\Customer\Model\ResourceModel\Address\Interceptor::class =>
478452
null, // customer_address_entity table info
479-
// Magento\LoginAsCustomerAssistance\Model\IsAssistanceEnabled::class =>
480-
// null, // FIXME: needs resetSate
481453
Magento\Quote\Model\Quote\Address\Total\Subtotal::class => null, // FIXME: these should not be reused.
482454
Magento\Quote\Model\Quote\Address\Total\Grand::class =>
483455
null, // FIXME: these should not be reused.
@@ -488,22 +460,14 @@
488460
Magento\Tax\Model\Sales\Total\Quote\Subtotal\Interceptor::class => null, // FIXME: these should not be reused.
489461
Magento\SalesRule\Model\ResourceModel\Rule::class => null,
490462
Magento\SalesRule\Model\Plugin\QuoteConfigProductAttributes::class => null,
491-
// Magento\QuoteGraphQl\Plugin\ProductAttributesExtender::class => null,
492-
493463
//Create Empty Cart
494464
Magento\Quote\Model\ResourceModel\Quote\QuoteIdMask::class => null,
495-
// Magento\Quote\Model\ResourceModel\Quote::class => null,
496-
// Magento\Quote\Model\QuoteIdToMaskedQuoteId::class => null,
497465
Magento\Quote\Model\Cart\CustomerCartResolver::class => null,
498466
Magento\QuoteGraphQl\Model\Cart\CreateEmptyCartForGuest::class => null,
499467
Magento\Quote\Model\MaskedQuoteIdToQuoteId::class => null,
500-
// Magento\SalesRule\Model\RulesApplier::class => null,
501-
// Magento\OfflineShipping\Model\SalesRule\Calculator::class => null,
502468
Magento\Quote\Model\Quote\Address\Total\Shipping::class => null,
503-
// Magento\SalesRule\Model\Validator::class => null,
504469
Magento\SalesRule\Model\Quote\Discount::class => null,
505470
Magento\Weee\Model\Total\Quote\Weee::class => null,
506-
// Magento\Quote\Model\Quote\Address\Total\Collector::class => null,
507471
Magento\Quote\Model\Quote\Interceptor::class => null,
508472
Magento\Quote\Model\ResourceModel\Quote\Address::class => null,
509473
Magento\Quote\Model\Quote\Address::class => null,
@@ -519,7 +483,6 @@
519483
Magento\AdobeCommerceEventsClient\Event\Filter\EventFieldsFilter::class => null,
520484
Magento\AdobeCommerceEventsClient\Event\EventStorageWriter::class => null,
521485
Magento\TestModuleAdobeCommerceEvents\Plugin\Framework\ManagerInterfacePlugin::class => null,
522-
523486
Magento\Catalog\Model\Product\Interceptor::class => null,
524487
Magento\Catalog\Model\Product\Attribute\Backend\Price\Interceptor::class => null,
525488
Magento\Catalog\Model\Product\Attribute\Backend\Tierprice\Interceptor::class => null,
@@ -538,21 +501,12 @@
538501
Magento\Quote\Model\ShippingAssignment::class => null,
539502
Magento\Quote\Model\Shipping::class => null,
540503
Magento\NegotiableQuote\Model\NegotiableQuote\Interceptor::class => null,
541-
// Magento\CatalogRule\Observer\RulePricesStorage::class => null,
542-
// Magento\CatalogRule\Observer\PrepareCatalogProductCollectionPricesObserver::class => null,
543504
Magento\Quote\Api\Data\CartExtension::class => null,
544505
Magento\Catalog\Api\Data\ProductExtension::class => null,
545-
// Magento\CatalogRule\Observer\ProcessFrontFinalPriceObserver::class => null,
546506
Magento\Quote\Api\Data\AddressExtension::class => null,
547-
// Magento\TestModuleAdobeCommerceEvents\Plugin\Framework\ManagerInterfacePlugin::class => null,
548507
Magento\CatalogRule\Observer\ProcessFrontFinalPriceObserver\Interceptor::class => null,
549508
Magento\Catalog\Model\Product\Type\Virtual\Interceptor::class => null,
550-
// Magento\NegotiableQuote\Model\NegotiableQuote\Interceptor::class => null,
551-
// Magento\CatalogInventory\Model\StockRegistryProvider::class => null,
552-
// Magento\CatalogInventory\Model\StockRegistry::class => null,
553-
// Magento\CatalogInventory\Helper\Stock::class => null,
554509
Magento\Catalog\Model\Product\Link\Interceptor::class => null,
555-
// Magento\Catalog\Model\Config::class => null,
556510
Magento\Bundle\Model\Product\Type\Interceptor::class => null,
557511
Magento\Bundle\Model\Product\LinksList::class => null,
558512
Magento\Bundle\Model\Product\OptionList::class => null,
@@ -590,13 +544,11 @@
590544
Magento\Checkout\Model\CaptchaRateLimiter::class => null,
591545
Magento\Captcha\Model\DefaultModel::class => null,
592546
Magento\Quote\Model\ResourceModel\Quote\Payment::class => null,
593-
// Magento\CustomerGraphQl\Plugin\ClearCustomerSessionAfterRequest::class => null,
594547
Magento\Company\Plugin\Framework\Model\ActionValidator\RemoveActionPlugin::class => null,
595548
Magento\Sales\Model\Order\ItemRepository\Interceptor::class => null,
596549
Magento\Sales\Model\ResourceModel\Order\Interceptor::class => null,
597550
Magento\Sales\Model\Order\Address\Validator::class => null,
598551
Magento\Quote\Model\SubmitQuoteValidator::class => null,
599-
// Magento\Sales\Model\Order\Email\Sender\OrderSender::class => null,
600552
Magento\Catalog\Model\Indexer\Product\Price\DimensionModeConfiguration::class => null,
601553
Magento\Catalog\Model\Indexer\Product\Price\PriceTableResolver::class => null,
602554
Magento\Sales\Model\Order\Config::class => null,
@@ -616,7 +568,6 @@
616568
Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory::class => null,
617569
Magento\Indexer\Model\Mview\View\State\Interceptor::class => null,
618570
Magento\Framework\Mview\View::class => null,
619-
// Magento\Framework\Validator\EmailAddress::class => null,
620571
Magento\Framework\Amqp\ConfigPool::class => null,
621572
Magento\Framework\Amqp\ExchangeFactory::class => null,
622573
Magento\Framework\MessageQueue\MessageEncoder::class => null,
@@ -644,29 +595,15 @@
644595
Magento\SalesRule\Model\Service\CouponUsagePublisher::class => null,
645596
Magento\Paypal\Model\Api\Nvp\Interceptor::class => null,
646597
Magento\PurchaseOrder\Model\PurchaseOrder\LogManagement::class => null,
647-
// Magento\Quote\Model\ResourceModel\Collection\Interceptor::class => null,
648598
Magento\Customer\Model\Metadata\AddressMetadata::class => null,
649599
Magento\Customer\Model\Metadata\AddressCachedMetadata::class => null,
650-
// Magento\Framework\App\ResourceConnection\Config::class => null,
651600
Magento\Framework\DB\Select\RendererProxy::class => null,
652601
Magento\Framework\DB\SelectFactory::class => null,
653602
Magento\Quote\Api\Data\CartItemExtension::class => null,
654-
// Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\QuoteItemQtyList::class => null,
655603
Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option\Interceptor::class => null,
656-
// Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\StockItem::class => null,
657-
// Magento\SalesRule\Model\Coupon\CodeLimitManager::class => null,
658-
// Magento\SalesRule\Observer\CouponCodeValidation::class => null,
659604
Magento\OfflineShipping\Model\Carrier\Flatrate::class => null,
660605
Magento\Quote\Model\Quote\Payment::class => null,
661-
// Magento\Sales\Model\Order\Email\Container\Template::class => null,
662-
// Magento\Sales\Model\Order\Email\Container\OrderIdentity::class => null,
663-
// Magento\Customer\Model\Address\Config::class => null,
664606
Magento\Sales\Model\Order\Address\Renderer::class => null,
665-
// Magento\Sales\Model\Order\Email\Sender\OrderCommentSender::class => null,
666-
// Magento\Sales\Model\Order\Email\Sender\InvoiceCommentSender::class => null,
667-
// Magento\Sales\Model\Order\Email\Sender\InvoiceSender::class => null,
668-
// Magento\Sales\Model\Order\Email\Sender\CreditmemoCommentSender::class => null,
669-
// Magento\Sales\Model\Order\Email\Sender\CreditmemoSender::class => null,
670607
Magento\Sales\Model\Order\Status::class => null,
671608
Magento\CatalogInventory\Model\Indexer\Stock\Action\Rows::class => null,
672609
Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\DefaultStock::class => null,

0 commit comments

Comments
 (0)