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(
189
189
Advanced $ advancedSearchResource = null
190
190
) {
191
191
$ 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);
196
194
$ this ->searchCriteriaResolverFactory = $ searchCriteriaResolverFactory ?: ObjectManager::getInstance ()
197
195
->get (SearchCriteriaResolverFactory::class);
198
196
$ this ->searchResultApplierFactory = $ searchResultApplierFactory ?: ObjectManager::getInstance ()
@@ -241,7 +239,7 @@ public function __construct(
241
239
public function addFieldsToFilter ($ fields )
242
240
{
243
241
if ($ fields ) {
244
- $ this ->filters = array_merge ($ this ->filters , $ fields );
242
+ $ this ->filters = array_replace_recursive ($ this ->filters , $ fields );
245
243
}
246
244
return $ this ;
247
245
}
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ public function testExecute(array $searchParams): void
65
65
$ this ->dispatch ('catalogsearch/advanced/result ' );
66
66
$ responseBody = $ this ->getResponse ()->getBody ();
67
67
$ this ->assertStringContainsString ('Simple product name ' , $ responseBody );
68
+ $ this ->assertStringNotContainsString ('Not visible simple product ' , $ responseBody );
68
69
}
69
70
70
71
/**
Original file line number Diff line number Diff line change 27
27
$ productRepository = $ objectManager ->get (ProductRepositoryInterface::class);
28
28
/** @var ProductFactory $productFactory */
29
29
$ productFactory = $ objectManager ->get (ProductFactory::class);
30
+
30
31
$ product = $ productFactory ->create ();
31
32
$ product ->isObjectNew (true );
32
33
$ product ->setTypeId (Type::TYPE_SIMPLE )
54
55
]
55
56
);
56
57
$ 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