Skip to content

Commit c9d8e95

Browse files
committed
ACP2E-685: Product set to 'Not Visible Individually' still appear in Catalog Advanced Search Results
1 parent 2df5106 commit c9d8e95

File tree

7 files changed

+38
-168
lines changed

7 files changed

+38
-168
lines changed

dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/Advanced/ResultTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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
/**

dev/tests/integration/testsuite/Magento/CatalogSearch/Model/AdvancedTest.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

dev/tests/integration/testsuite/Magento/CatalogSearch/_files/not_visible_searchable_product.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

dev/tests/integration/testsuite/Magento/CatalogSearch/_files/not_visible_searchable_product_rollback.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
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)
@@ -54,3 +55,31 @@
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);

dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search_rollback.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@
77
declare(strict_types=1);
88

99
use Magento\Catalog\Api\ProductRepositoryInterface;
10+
use Magento\Catalog\Model\Product;
11+
use Magento\Eav\Setup\EavSetup;
12+
use Magento\Eav\Setup\EavSetupFactory;
1013
use Magento\Framework\Exception\NoSuchEntityException;
1114
use Magento\Framework\Registry;
1215
use Magento\TestFramework\Helper\Bootstrap;
1316
use Magento\TestFramework\ObjectManager;
14-
use Magento\TestFramework\Workaround\Override\Fixture\Resolver;
1517

1618
/** @var ObjectManager $objectManager */
1719
$objectManager = Bootstrap::getObjectManager();
20+
/** @var EavSetupFactory $eavSetupFactory */
21+
$eavSetupFactory = $objectManager->create(EavSetupFactory::class);
1822
/** @var Registry $registry */
1923
$registry = $objectManager->get(Registry::class);
2024
/** @var ProductRepositoryInterface $productRepository */
@@ -27,8 +31,9 @@
2731
} catch (NoSuchEntityException $e) {
2832
//Product already deleted.
2933
}
34+
/** @var EavSetup $eavSetup */
35+
$eavSetup = $eavSetupFactory->create();
36+
$eavSetup->removeAttribute(Product::ENTITY, 'test_searchable_attribute');
3037

3138
$registry->unregister('isSecureArea');
3239
$registry->register('isSecureArea', false);
33-
34-
Resolver::getInstance()->requireDataFixture('Magento/CatalogSearch/_files/searchable_attribute_rollback.php');

dev/tests/integration/testsuite/Magento/CatalogSearch/_files/searchable_attribute_rollback.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)