@@ -502,6 +502,57 @@ public function testAnchorCategory()
502
502
$ this ->assertEquals ($ expectedResponse , $ response );
503
503
}
504
504
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
+
505
556
/**
506
557
* @param ProductInterface $product
507
558
* @param array $actualResponse
0 commit comments