Skip to content

Commit 252f4da

Browse files
Merge branch 'ACQE-8696' into ACQE-functional-deployment-v3-9
2 parents 3d8ce17 + 2cba96f commit 252f4da

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\GraphQl\Catalog;
10+
11+
use Magento\Catalog\Model\Product\Visibility;
12+
use Magento\Catalog\Test\Fixture\Product as ProductFixture;
13+
use Magento\TestFramework\Fixture\DataFixture;
14+
use Magento\TestFramework\TestCase\GraphQlAbstract;
15+
16+
class ProductVisibilitySearchTest extends GraphQlAbstract
17+
{
18+
/**
19+
* Verify that a product with "Catalog Only" visibility
20+
* is not returned in GraphQL product search results.
21+
*/
22+
#[DataFixture(
23+
ProductFixture::class,
24+
['price' => 1, 'name' => 'API_TEST', 'visibility' => Visibility::VISIBILITY_IN_CATALOG],
25+
'prod1'
26+
)]
27+
public function testProductNotReturnedWhenVisibilityIsCatalogOnly(): void
28+
{
29+
$query = <<<'QUERY'
30+
query {
31+
products(
32+
search: "API"
33+
filter: { price: { from: "1" } }
34+
) {
35+
items {
36+
name
37+
sku
38+
}
39+
}
40+
}
41+
QUERY;
42+
43+
$response = $this->graphQlQuery($query);
44+
$this->assertArrayNotHasKey('errors', $response);
45+
$this->assertEmpty(
46+
$response['products']['items'],
47+
'Expected no products to be returned when product is set to Catalog-only visibility.'
48+
);
49+
}
50+
}

0 commit comments

Comments
 (0)