@@ -81,9 +81,23 @@ protected function setUp()
81
81
82
82
public function testCopy ()
83
83
{
84
+ $ stockItem = $ this ->getMockBuilder (\Magento \CatalogInventory \Api \Data \StockItemInterface::class)
85
+ ->getMock ();
86
+ $ extensionAttributes = $ this ->getMockBuilder (\Magento \Catalog \Api \Data \ProductExtension::class)
87
+ ->setMethods (['getStockItem ' , 'setData ' ])
88
+ ->getMock ();
89
+ $ extensionAttributes
90
+ ->expects ($ this ->once ())
91
+ ->method ('getStockItem ' )
92
+ ->willReturn ($ stockItem );
93
+ $ extensionAttributes
94
+ ->expects ($ this ->once ())
95
+ ->method ('setData ' )
96
+ ->with ('stock_item ' , null );
97
+
84
98
$ productData = [
85
99
'product data ' => ['product data ' ],
86
- ProductInterface::EXTENSION_ATTRIBUTES_KEY => [] ,
100
+ ProductInterface::EXTENSION_ATTRIBUTES_KEY => $ extensionAttributes ,
87
101
];
88
102
$ this ->productMock ->expects ($ this ->atLeastOnce ())->method ('getWebsiteIds ' );
89
103
$ this ->productMock ->expects ($ this ->atLeastOnce ())->method ('getCategoryIds ' );
@@ -140,7 +154,7 @@ public function testCopy()
140
154
)->with (
141
155
\Magento \Store \Model \Store::DEFAULT_STORE_ID
142
156
);
143
- $ duplicateMock ->expects ($ this ->once ())->method ('setData ' )->with ([ ' product data ' => [ ' product data ' ]] );
157
+ $ duplicateMock ->expects ($ this ->once ())->method ('setData ' )->with ($ productData );
144
158
$ this ->copyConstructorMock ->expects ($ this ->once ())->method ('build ' )->with ($ this ->productMock , $ duplicateMock );
145
159
$ duplicateMock ->expects ($ this ->once ())->method ('getUrlKey ' )->willReturn ('urk-key-1 ' );
146
160
$ duplicateMock ->expects ($ this ->once ())->method ('setUrlKey ' )->with ('urk-key-2 ' );
0 commit comments