Skip to content

Commit 7f93862

Browse files
committed
magento/magento2ce#31253:Default store (Root category A) breadcrumbs are being returned for New Store (Root category B) when Product belongs to both root categories - added test for not relevant store
1 parent f9df4da commit 7f93862

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/Product/ProductCategoriesTest.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,13 @@
88

99
namespace Magento\GraphQl\Catalog\Product;
1010

11-
use Magento\Framework\ObjectManagerInterface;
12-
use Magento\TestFramework\Helper\Bootstrap;
1311
use Magento\TestFramework\TestCase\GraphQlAbstract;
1412

1513
/**
1614
* Test for product categories
1715
*/
1816
class ProductCategoriesTest extends GraphQlAbstract
1917
{
20-
/**
21-
* @var ObjectManagerInterface
22-
*/
23-
private $objectManager;
24-
25-
/**
26-
* @inheritdoc
27-
*/
28-
protected function setUp(): void
29-
{
30-
$this->objectManager = Bootstrap::getObjectManager();
31-
}
32-
3318
/**
3419
* @magentoApiDataFixture Magento/Catalog/_files/product_in_two_root_categories.php
3520
*/
@@ -71,12 +56,27 @@ public function testProductCategoriesInNonDefaultStore(): void
7156
self::assertEquals('Second Root Subcategory', $categories[0]['name']);
7257
self::assertEquals('second-root-subcategory', $categories[0]['url_path']);
7358
self::assertNull($categories[0]['breadcrumbs']);
74-
self::assertEquals('Second Root Subcategory', $categories[1]['name']);
59+
self::assertEquals('Second Root Subsubcategory', $categories[1]['name']);
7560
self::assertEquals('second-root-subcategory/second-root-subsubcategory', $categories[1]['url_path']);
76-
self::assertNotNull($categories[1]['breadcrumbs']);
77-
self::assertEquals('Second Root Subcategory', $categories[1]['category_name']);
78-
self::assertEquals('Second Root Subcategory', $categories[1]['category_name']);
79-
self::assertEquals(2, $categories[1]['category_level']);
61+
self::assertCount(1, $categories[1]['breadcrumbs']);
62+
self::assertEquals('Second Root Subcategory', $categories[1]['breadcrumbs'][0]['category_name']);
63+
self::assertEquals(2, $categories[1]['breadcrumbs'][0]['category_level']);
64+
}
65+
66+
/**
67+
* @magentoApiDataFixture Magento/Catalog/_files/product_in_two_root_categories.php
68+
* @magentoApiDataFixture Magento/Store/_files/second_store.php
69+
*/
70+
public function testProductCategoriesInNotRelevantStore(): void
71+
{
72+
$response = $this->graphQlQuery(
73+
$this->getQuery('in-stock-product'),
74+
[],
75+
'',
76+
['Store' => 'fixture_second_store']
77+
);
78+
79+
self::assertEmpty($response['products']['items']);
8080
}
8181

8282
/**

0 commit comments

Comments
 (0)