File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
dev/tests/api-functional/testsuite/Magento/Catalog/Api Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -679,6 +679,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
679
679
$ collection ->setCurPage ($ searchCriteria ->getCurrentPage ());
680
680
$ collection ->setPageSize ($ searchCriteria ->getPageSize ());
681
681
$ collection ->load ();
682
+ $ collection ->addCategoryIds ();
682
683
683
684
$ searchResult = $ this ->searchResultsFactory ->create ();
684
685
$ searchResult ->setSearchCriteria ($ searchCriteria );
Original file line number Diff line number Diff line change @@ -632,6 +632,7 @@ public function testGetList($fieldName)
632
632
$ searchCriteriaMock ->expects ($ this ->once ())->method ('getPageSize ' )->willReturn (42 );
633
633
$ collectionMock ->expects ($ this ->once ())->method ('setPageSize ' )->with (42 );
634
634
$ collectionMock ->expects ($ this ->once ())->method ('load ' );
635
+ $ collectionMock ->expects ($ this ->once ())->method ('addCategoryIds ' );
635
636
$ collectionMock ->expects ($ this ->once ())->method ('getItems ' )->willReturn ([$ itemsMock ]);
636
637
$ collectionMock ->expects ($ this ->once ())->method ('getSize ' )->willReturn (128 );
637
638
$ searchResultsMock = $ this ->getMock (
Original file line number Diff line number Diff line change @@ -574,7 +574,19 @@ public function testGetList()
574
574
575
575
$ this ->assertNotNull ($ response ['items ' ][0 ]['sku ' ]);
576
576
$ this ->assertEquals ('simple ' , $ response ['items ' ][0 ]['sku ' ]);
577
- }
577
+
578
+
579
+ $ index = null ;
580
+ foreach ($ response ['items ' ][0 ]['custom_attributes ' ] as $ key => $ customAttribute ) {
581
+ if ($ customAttribute ['attribute_code ' ] == 'category_ids ' ) {
582
+ $ index = $ key ;
583
+ break ;
584
+ }
585
+ }
586
+ $ this ->assertNotNull ($ index , 'Category information wasn \'t set ' );
587
+
588
+ $ expectedResult = (TESTS_WEB_API_ADAPTER == self ::ADAPTER_SOAP ) ? ['string ' => '2 ' ] : ['2 ' ];
589
+ $ this ->assertEquals ($ expectedResult , $ response ['items ' ][0 ]['custom_attributes ' ][$ index ]['value ' ]); }
578
590
579
591
/**
580
592
* @param $customAttributes
You can’t perform that action at this time.
0 commit comments