Skip to content

Commit dd07ac6

Browse files
committed
MAGETWO-55038: Add CategoryProductLinkInterface as Extension attributes to ProductInterface entitygit
1 parent ae8e60e commit dd07ac6

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

app/code/Magento/Catalog/Model/Category/Link/ReadHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function execute($entity, $arguments = [])
5959
$this->dataObjectHelper->populateWithArray(
6060
$categoryLink,
6161
$categoryData,
62-
'\Magento\Catalog\Api\Data\CategoryLinkInterface'
62+
\Magento\Catalog\Api\Data\CategoryLinkInterface::class
6363
);
6464
$categoryLinks[] = $categoryLink;
6565
}

app/code/Magento/Catalog/Test/Unit/Model/Category/Link/ReadHandlerTest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
*/
66
namespace Magento\Catalog\Test\Unit\Model\Category\Link;
77

8+
use Magento\Catalog\Api\Data\CategoryLinkInterface;
89
use Magento\Catalog\Api\Data\CategoryLinkInterfaceFactory;
10+
use Magento\Catalog\Api\Data\ProductExtensionInterface;
911
use Magento\Catalog\Model\Category\Link\ReadHandler;
1012
use Magento\Catalog\Model\ResourceModel\Product\CategoryLink;
1113
use Magento\Framework\Api\DataObjectHelper;
@@ -66,10 +68,14 @@ public function testExecute()
6668
['category_id' => 3, 'position' => 10],
6769
['category_id' => 4, 'position' => 20]
6870
];
71+
6972
$dtoCategoryLinks = [];
7073
foreach ($categoryLinks as $key => $categoryLink) {
71-
$dtoCategoryLinks[$key] = $this->getMockBuilder(\Magento\Catalog\Api\Data\CategoryLinkInterface::class)
74+
$dtoCategoryLinks[$key] = $this->getMockBuilder(CategoryLinkInterface::class)
7275
->getMockForAbstractClass();
76+
$this->dataObjectHelper->expects(static::at($key))
77+
->method('populateWithArray')
78+
->with($dtoCategoryLinks[$key], $categoryLink, CategoryLinkInterface::class);
7379
$this->categoryLinkFactory->expects(static::at($key))
7480
->method('create')
7581
->willReturn($dtoCategoryLinks[$key]);
@@ -80,7 +86,7 @@ public function testExecute()
8086
->setMethods(['getExtensionAttributes', 'setExtensionAttributes'])
8187
->getMock();
8288

83-
$extensionAttributes = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductExtensionInterface::class)
89+
$extensionAttributes = $this->getMockBuilder(ProductExtensionInterface::class)
8490
->disableOriginalConstructor()
8591
->setMethods(['setCategoryLinks'])
8692
->getMockForAbstractClass();
@@ -110,7 +116,7 @@ public function testExecuteNullExtensionAttributes()
110116
->setMethods(['getExtensionAttributes', 'setExtensionAttributes'])
111117
->getMock();
112118

113-
$extensionAttributes = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductExtensionInterface::class)
119+
$extensionAttributes = $this->getMockBuilder(ProductExtensionInterface::class)
114120
->disableOriginalConstructor()
115121
->setMethods(['setCategoryLinks'])
116122
->getMockForAbstractClass();

0 commit comments

Comments
 (0)