7
7
8
8
namespace Magento \Quote \Test \Unit \Model \Quote \Item ;
9
9
10
- use \ Magento \Quote \Model \Quote \Item \Repository ;
10
+ use Magento \Quote \Model \Quote \Item \Repository ;
11
11
12
12
class RepositoryTest extends \PHPUnit_Framework_TestCase
13
13
{
@@ -292,15 +292,13 @@ public function testDeleteWithInvalidQuoteItem()
292
292
{
293
293
$ cartId = 11 ;
294
294
$ itemId = 5 ;
295
- $ this ->dataMock ->expects ($ this ->once ())->method ('getQuoteId ' )->willReturn ($ cartId );
296
- $ this ->dataMock ->expects ($ this ->once ())->method ('getItemId ' )->willReturn ($ itemId );
297
295
$ this ->quoteRepositoryMock ->expects ($ this ->once ())
298
296
->method ('getActive ' )->with ($ cartId )->will ($ this ->returnValue ($ this ->quoteMock ));
299
297
$ this ->quoteMock ->expects ($ this ->once ())
300
298
->method ('getItemById ' )->with ($ itemId )->will ($ this ->returnValue (false ));
301
299
$ this ->quoteMock ->expects ($ this ->never ())->method ('removeItem ' );
302
300
303
- $ this ->repository ->delete ( $ this -> dataMock );
301
+ $ this ->repository ->deleteById ( $ cartId , $ itemId );
304
302
}
305
303
306
304
/**
@@ -312,8 +310,6 @@ public function testDeleteWithCouldNotSaveException()
312
310
{
313
311
$ cartId = 11 ;
314
312
$ itemId = 5 ;
315
- $ this ->dataMock ->expects ($ this ->once ())->method ('getQuoteId ' )->willReturn ($ cartId );
316
- $ this ->dataMock ->expects ($ this ->once ())->method ('getItemId ' )->willReturn ($ itemId );
317
313
$ this ->quoteRepositoryMock ->expects ($ this ->once ())
318
314
->method ('getActive ' )->with ($ cartId )->will ($ this ->returnValue ($ this ->quoteMock ));
319
315
$ this ->quoteMock ->expects ($ this ->once ())
@@ -328,27 +324,7 @@ public function testDeleteWithCouldNotSaveException()
328
324
->with ($ this ->quoteMock )
329
325
->willThrowException ($ exception );
330
326
331
- $ this ->repository ->delete ($ this ->dataMock );
332
- }
333
-
334
- /**
335
- * @return void
336
- */
337
- public function testDelete ()
338
- {
339
- $ cartId = 11 ;
340
- $ itemId = 5 ;
341
- $ this ->dataMock ->expects ($ this ->once ())->method ('getQuoteId ' )->willReturn ($ cartId );
342
- $ this ->dataMock ->expects ($ this ->once ())->method ('getItemId ' )->willReturn ($ itemId );
343
- $ this ->quoteRepositoryMock ->expects ($ this ->once ())
344
- ->method ('getActive ' )->with ($ cartId )->will ($ this ->returnValue ($ this ->quoteMock ));
345
- $ this ->quoteMock ->expects ($ this ->once ())
346
- ->method ('getItemById ' )->with ($ itemId )->will ($ this ->returnValue ($ this ->quoteItemMock ));
347
- $ this ->quoteMock ->expects ($ this ->once ())->method ('removeItem ' );
348
- $ this ->quoteMock ->expects ($ this ->once ())->method ('collectTotals ' )->will ($ this ->returnValue ($ this ->quoteMock ));
349
- $ this ->quoteRepositoryMock ->expects ($ this ->once ())->method ('save ' )->with ($ this ->quoteMock );
350
-
351
- $ this ->repository ->delete ($ this ->dataMock );
327
+ $ this ->repository ->deleteById ($ cartId , $ itemId );
352
328
}
353
329
354
330
/**
@@ -363,13 +339,6 @@ public function testDeleteByIdForCustomer()
363
339
->with ($ customerId )
364
340
->will ($ this ->returnValue ($ this ->quoteMock ));
365
341
$ this ->quoteMock ->expects ($ this ->once ())->method ('getId ' )->willReturn ($ cartId );
366
- $ this ->itemDataFactoryMock ->expects ($ this ->once ())->method ('create ' )->willReturn ($ this ->dataMock );
367
- $ this ->dataMock ->expects ($ this ->once ())->method ('setQuoteId ' )
368
- ->with ($ cartId )->willReturn ($ this ->dataMock );
369
- $ this ->dataMock ->expects ($ this ->once ())->method ('setItemId ' )
370
- ->with ($ itemId )->willReturn ($ this ->dataMock );
371
- $ this ->dataMock ->expects ($ this ->once ())->method ('getQuoteId ' )->willReturn ($ cartId );
372
- $ this ->dataMock ->expects ($ this ->once ())->method ('getItemId ' )->willReturn ($ itemId );
373
342
$ this ->quoteRepositoryMock ->expects ($ this ->once ())
374
343
->method ('getActive ' )->with ($ cartId )->will ($ this ->returnValue ($ this ->quoteMock ));
375
344
$ this ->quoteMock ->expects ($ this ->once ())
@@ -424,13 +393,6 @@ public function testDeleteById()
424
393
{
425
394
$ cartId = 11 ;
426
395
$ itemId = 5 ;
427
- $ this ->itemDataFactoryMock ->expects ($ this ->once ())->method ('create ' )->willReturn ($ this ->dataMock );
428
- $ this ->dataMock ->expects ($ this ->once ())->method ('setQuoteId ' )
429
- ->with ($ cartId )->willReturn ($ this ->dataMock );
430
- $ this ->dataMock ->expects ($ this ->once ())->method ('setItemId ' )
431
- ->with ($ itemId )->willReturn ($ this ->dataMock );
432
- $ this ->dataMock ->expects ($ this ->once ())->method ('getQuoteId ' )->willReturn ($ cartId );
433
- $ this ->dataMock ->expects ($ this ->once ())->method ('getItemId ' )->willReturn ($ itemId );
434
396
$ this ->quoteRepositoryMock ->expects ($ this ->once ())
435
397
->method ('getActive ' )->with ($ cartId )->will ($ this ->returnValue ($ this ->quoteMock ));
436
398
$ this ->quoteMock ->expects ($ this ->once ())
0 commit comments