Skip to content

Commit b7faf24

Browse files
author
Prabhu Ram
committed
MC-20255: Category Breadcrumbs are missing url_path
- Added api functional test
1 parent 635c373 commit b7faf24

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,57 @@ public function testAnchorCategory()
502502
$this->assertEquals($expectedResponse, $response);
503503
}
504504

505+
/**
506+
* @magentoApiDataFixture Magento/Catalog/_files/categories.php
507+
*/
508+
public function testBreadCrumbs()
509+
{
510+
/** @var CategoryCollection $categoryCollection */
511+
$categoryCollection = $this->objectManager->create(CategoryCollection::class);
512+
$categoryCollection->addFieldToFilter('name', 'Category 1.1.1');
513+
/** @var CategoryInterface $category */
514+
$category = $categoryCollection->getFirstItem();
515+
$categoryId = $category->getId();
516+
$this->assertNotEmpty($categoryId, "Preconditions failed: category is not available.");
517+
$query = <<<QUERY
518+
{
519+
category(id: {$categoryId}) {
520+
name
521+
breadcrumbs {
522+
category_id
523+
category_name
524+
category_level
525+
category_url_key
526+
category_url_path
527+
}
528+
}
529+
}
530+
QUERY;
531+
$response = $this->graphQlQuery($query);
532+
$expectedResponse = [
533+
'category' => [
534+
'name' => 'Category 1.1.1',
535+
'breadcrumbs' => [
536+
[
537+
'category_id' => 3,
538+
'category_name' => "Category 1",
539+
'category_level' => 2,
540+
'category_url_key' => "category-1",
541+
'category_url_path' => "category-1"
542+
],
543+
[
544+
'category_id' => 4,
545+
'category_name' => "Category 1.1",
546+
'category_level' => 3,
547+
'category_url_key' => "category-1-1",
548+
'category_url_path' => "category-1/category-1-1"
549+
],
550+
]
551+
]
552+
];
553+
$this->assertEquals($expectedResponse, $response);
554+
}
555+
505556
/**
506557
* @param ProductInterface $product
507558
* @param array $actualResponse

0 commit comments

Comments
 (0)