File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed
dev/tests/api-functional/testsuite/Magento/Catalog/Api Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -640,6 +640,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
640
640
641
641
$ collection ->load ();
642
642
643
+ $ collection ->addCategoryIds ();
643
644
$ searchResult = $ this ->searchResultsFactory ->create ();
644
645
$ searchResult ->setSearchCriteria ($ searchCriteria );
645
646
$ searchResult ->setItems ($ collection ->getItems ());
Original file line number Diff line number Diff line change @@ -715,6 +715,7 @@ public function testGetList()
715
715
->method ('process ' )
716
716
->with ($ searchCriteriaMock , $ collectionMock );
717
717
$ collectionMock ->expects ($ this ->once ())->method ('load ' );
718
+ $ collectionMock ->expects ($ this ->once ())->method ('addCategoryIds ' );
718
719
$ collectionMock ->expects ($ this ->once ())->method ('getItems ' )->willReturn ([$ itemsMock ]);
719
720
$ collectionMock ->expects ($ this ->once ())->method ('getSize ' )->willReturn (128 );
720
721
$ searchResultsMock = $ this ->getMock (
Original file line number Diff line number Diff line change @@ -713,6 +713,16 @@ public function testGetList()
713
713
714
714
$ this ->assertNotNull ($ response ['items ' ][0 ]['sku ' ]);
715
715
$ this ->assertEquals ('simple ' , $ response ['items ' ][0 ]['sku ' ]);
716
+ $ isCategoryInformationExist = false ;
717
+ $ index = null ;
718
+ foreach ($ response ['items ' ][0 ]['custom_attributes ' ] as $ key => $ customAttribute ) {
719
+ if ($ customAttribute ['attribute_code ' ] == 'category_ids ' ) {
720
+ $ isCategoryInformationExist = true ;
721
+ $ index = $ key ;
722
+ }
723
+ }
724
+ $ this ->assertTrue ($ isCategoryInformationExist , 'Category information wasn \'t set ' );
725
+ $ this ->assertEquals ([2 ], $ response ['items ' ][0 ]['custom_attributes ' ][$ index ]['value ' ]);
716
726
}
717
727
718
728
/**
You can’t perform that action at this time.
0 commit comments