File tree Expand file tree Collapse file tree 3 files changed +33
-5
lines changed
app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced
dev/tests/integration/testsuite/Magento/CatalogSearch Expand file tree Collapse file tree 3 files changed +33
-5
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 ()
@@ -241,7 +239,7 @@ public function __construct(
241239 public function addFieldsToFilter ($ fields )
242240 {
243241 if ($ fields ) {
244- $ this ->filters = array_merge ($ this ->filters , $ fields );
242+ $ this ->filters = array_replace_recursive ($ this ->filters , $ fields );
245243 }
246244 return $ this ;
247245 }
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ public function testExecute(array $searchParams): void
6565 $ this ->dispatch ('catalogsearch/advanced/result ' );
6666 $ responseBody = $ this ->getResponse ()->getBody ();
6767 $ this ->assertStringContainsString ('Simple product name ' , $ responseBody );
68+ $ this ->assertStringNotContainsString ('Not visible simple product ' , $ responseBody );
6869 }
6970
7071 /**
Original file line number Diff line number Diff line change 2727$ productRepository = $ objectManager ->get (ProductRepositoryInterface::class);
2828/** @var ProductFactory $productFactory */
2929$ productFactory = $ objectManager ->get (ProductFactory::class);
30+
3031$ product = $ productFactory ->create ();
3132$ product ->isObjectNew (true );
3233$ product ->setTypeId (Type::TYPE_SIMPLE )
5455 ]
5556 );
5657$ productRepository ->save ($ product );
58+
59+ $ product = $ productFactory ->create ();
60+ $ product ->isObjectNew (true );
61+ $ product ->setTypeId (Type::TYPE_SIMPLE )
62+ ->setAttributeSetId ($ product ->getDefaultAttributeSetId ())
63+ ->setWebsiteIds ([1 ])
64+ ->setName ('Not visible simple product ' )
65+ ->setSku ('not_visible_simple ' )
66+ ->setPrice (100 )
67+ ->setWeight (1 )
68+ ->setShortDescription ('Product short description ' )
69+ ->setTaxClassId (0 )
70+ ->setDescription ('Product description ' )
71+ ->setMetaTitle ('meta title ' )
72+ ->setMetaKeyword ('meta keyword ' )
73+ ->setMetaDescription ('meta description ' )
74+ ->setVisibility (Visibility::VISIBILITY_NOT_VISIBLE )
75+ ->setStatus (Status::STATUS_ENABLED )
76+ ->setTestSearchableAttribute ($ attribute ->getSource ()->getOptionId ('Option 1 ' ))
77+ ->setStockData (
78+ [
79+ 'use_config_manage_stock ' => 1 ,
80+ 'qty ' => 100 ,
81+ 'is_qty_decimal ' => 0 ,
82+ 'is_in_stock ' => 1 ,
83+ ]
84+ );
85+ $ productRepository ->save ($ product );
You can’t perform that action at this time.
0 commit comments