|
8 | 8 |
|
9 | 9 | namespace Magento\GraphQl\Catalog\Product;
|
10 | 10 |
|
11 |
| -use Magento\Framework\ObjectManagerInterface; |
12 |
| -use Magento\TestFramework\Helper\Bootstrap; |
13 | 11 | use Magento\TestFramework\TestCase\GraphQlAbstract;
|
14 | 12 |
|
15 | 13 | /**
|
16 | 14 | * Test for product categories
|
17 | 15 | */
|
18 | 16 | class ProductCategoriesTest extends GraphQlAbstract
|
19 | 17 | {
|
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 |
| - |
33 | 18 | /**
|
34 | 19 | * @magentoApiDataFixture Magento/Catalog/_files/product_in_two_root_categories.php
|
35 | 20 | */
|
@@ -71,12 +56,27 @@ public function testProductCategoriesInNonDefaultStore(): void
|
71 | 56 | self::assertEquals('Second Root Subcategory', $categories[0]['name']);
|
72 | 57 | self::assertEquals('second-root-subcategory', $categories[0]['url_path']);
|
73 | 58 | self::assertNull($categories[0]['breadcrumbs']);
|
74 |
| - self::assertEquals('Second Root Subcategory', $categories[1]['name']); |
| 59 | + self::assertEquals('Second Root Subsubcategory', $categories[1]['name']); |
75 | 60 | 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']); |
80 | 80 | }
|
81 | 81 |
|
82 | 82 | /**
|
|
0 commit comments