13
13
use Magento \Framework \App \Helper \Context ;
14
14
use Magento \Framework \App \RequestInterface ;
15
15
use Magento \Framework \Data \Helper \PostHelper ;
16
+ use Magento \Framework \DataObject ;
16
17
use Magento \Framework \Registry ;
17
18
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
18
19
use Magento \Framework \Url \EncoderInterface ;
@@ -186,11 +187,27 @@ public function testGetConfigureUrl()
186
187
{
187
188
$ url = 'http://magento2ce/wishlist/index/configure/id/4/product_id/30/qty/1000 ' ;
188
189
190
+ $ buyRequest = $ this ->getMockBuilder (DataObject::class)
191
+ ->addMethods (['getSuperAttribute ' , 'getQty ' ])
192
+ ->disableOriginalConstructor ()
193
+ ->getMock ();
194
+ $ buyRequest ->expects ($ this ->once ())
195
+ ->method ('getSuperAttribute ' )
196
+ ->willReturn (['100 ' => '10 ' ]);
197
+ $ buyRequest ->expects ($ this ->exactly (2 ))
198
+ ->method ('getQty ' )
199
+ ->willReturn ('1000 ' );
200
+
189
201
/** @var WishlistItem|MockObject $wishlistItem */
190
202
$ wishlistItem = $ this ->getMockBuilder (WishlistItem::class)
191
203
->addMethods (['getWishlistItemId ' , 'getProductId ' , 'getQty ' ])
204
+ ->onlyMethods (['getBuyRequest ' ])
192
205
->disableOriginalConstructor ()
193
206
->getMock ();
207
+ $ wishlistItem
208
+ ->expects ($ this ->once ())
209
+ ->method ('getBuyRequest ' )
210
+ ->willReturn ($ buyRequest );
194
211
$ wishlistItem
195
212
->expects ($ this ->once ())
196
213
->method ('getWishlistItemId ' )
@@ -209,7 +226,7 @@ public function testGetConfigureUrl()
209
226
->with ('wishlist/index/configure ' , ['id ' => 4 , 'product_id ' => 30 , 'qty ' => 1000 ])
210
227
->willReturn ($ url );
211
228
212
- $ this ->assertEquals ($ url , $ this ->model ->getConfigureUrl ($ wishlistItem ));
229
+ $ this ->assertEquals ($ url . ' #100=10 ' , $ this ->model ->getConfigureUrl ($ wishlistItem ));
213
230
}
214
231
215
232
public function testGetWishlist ()
0 commit comments