File tree Expand file tree Collapse file tree 2 files changed +33
-4
lines changed
app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced
dev/tests/integration/testsuite/Magento/CatalogSearch/_files Expand file tree Collapse file tree 2 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -189,10 +189,8 @@ public function __construct(
189189 Advanced $ advancedSearchResource = null
190190 ) {
191191 $ this ->searchRequestName = $ searchRequestName ;
192- if ($ searchResultFactory === null ) {
193- $ this ->searchResultFactory = \Magento \Framework \App \ObjectManager::getInstance ()
194- ->get (\Magento \Framework \Api \Search \SearchResultFactory::class);
195- }
192+ $ this ->searchResultFactory = $ searchResultFactory ?: ObjectManager::getInstance ()
193+ ->get (SearchResultFactory::class);
196194 $ this ->searchCriteriaResolverFactory = $ searchCriteriaResolverFactory ?: ObjectManager::getInstance ()
197195 ->get (SearchCriteriaResolverFactory::class);
198196 $ this ->searchResultApplierFactory = $ searchResultApplierFactory ?: ObjectManager::getInstance ()
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magento, Inc. All rights reserved.
4+ * See COPYING.txt for license details.
5+ */
6+ declare (strict_types=1 );
7+
8+ use Magento \Catalog \Api \ProductAttributeRepositoryInterface ;
9+ use Magento \Eav \Model \Config ;
10+ use Magento \Framework \Exception \NoSuchEntityException ;
11+ use Magento \Framework \Registry ;
12+ use Magento \TestFramework \Helper \Bootstrap ;
13+
14+ $ objectManager = Bootstrap::getObjectManager ();
15+
16+ $ registry = $ objectManager ->get (Registry::class);
17+ $ registry ->unregister ('isSecureArea ' );
18+ $ registry ->register ('isSecureArea ' , true );
19+
20+ $ attributeRepository = $ objectManager ->get (ProductAttributeRepositoryInterface::class);
21+ try {
22+ $ attribute = $ attributeRepository ->get ('test_searchable_attribute ' );
23+ $ attributeRepository ->delete ($ attribute );
24+ } catch (NoSuchEntityException $ e ) {
25+ //Attribute already removed
26+ }
27+ $ eavConfig = $ objectManager ->get (Config::class);
28+ $ eavConfig ->clear ();
29+
30+ $ registry ->unregister ('isSecureArea ' );
31+ $ registry ->register ('isSecureArea ' , false );
You can’t perform that action at this time.
0 commit comments