Skip to content

Commit abc6900

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-59727' into 2.0-develop-pr3
2 parents 8498721 + bb8e1f8 commit abc6900

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
679679
$collection->setCurPage($searchCriteria->getCurrentPage());
680680
$collection->setPageSize($searchCriteria->getPageSize());
681681
$collection->load();
682+
$collection->addCategoryIds();
682683

683684
$searchResult = $this->searchResultsFactory->create();
684685
$searchResult->setSearchCriteria($searchCriteria);

app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ public function testGetList($fieldName)
632632
$searchCriteriaMock->expects($this->once())->method('getPageSize')->willReturn(42);
633633
$collectionMock->expects($this->once())->method('setPageSize')->with(42);
634634
$collectionMock->expects($this->once())->method('load');
635+
$collectionMock->expects($this->once())->method('addCategoryIds');
635636
$collectionMock->expects($this->once())->method('getItems')->willReturn([$itemsMock]);
636637
$collectionMock->expects($this->once())->method('getSize')->willReturn(128);
637638
$searchResultsMock = $this->getMock(

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,19 @@ public function testGetList()
574574

575575
$this->assertNotNull($response['items'][0]['sku']);
576576
$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']); }
578590

579591
/**
580592
* @param $customAttributes

0 commit comments

Comments
 (0)