Skip to content

Commit 9dbffdb

Browse files
committed
MAGETWO-36378: Magento\Quote\Api\GuestCartManagement
- Remove \Magento\Quote\Model\GuestCart\GuestCartManagement::getCartForCustomer - Remove $quoteRepository from the parameters of GuestCartManagement::__construct - Update unit test accordingly
1 parent 300d8db commit 9dbffdb

File tree

2 files changed

+0
-38
lines changed

2 files changed

+0
-38
lines changed

app/code/Magento/Quote/Model/GuestCart/GuestCartManagement.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
use Magento\Quote\Api\CartManagementInterface;
1111
use Magento\Quote\Model\QuoteIdMask;
1212
use Magento\Quote\Model\QuoteIdMaskFactory;
13-
use Magento\Quote\Model\QuoteManagement;
14-
use Magento\Quote\Model\QuoteRepository;
1513

1614
/**
1715
* Cart Management class for guest carts.
@@ -25,11 +23,6 @@ class GuestCartManagement implements GuestCartManagementInterface
2523
*/
2624
protected $quoteManagement;
2725

28-
/**
29-
* @var QuoteRepository
30-
*/
31-
protected $quoteRepository;
32-
3326
/**
3427
* @var QuoteIdMaskFactory
3528
*/
@@ -39,17 +32,14 @@ class GuestCartManagement implements GuestCartManagementInterface
3932
* Initialize dependencies.
4033
*
4134
* @param CartManagementInterface $quoteManagement
42-
* @param QuoteRepository $quoteRepository
4335
* @param QuoteIdMaskFactory $quoteIdMaskFactory
4436
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
4537
*/
4638
public function __construct(
4739
CartManagementInterface $quoteManagement,
48-
QuoteRepository $quoteRepository,
4940
QuoteIdMaskFactory $quoteIdMaskFactory
5041
) {
5142
$this->quoteManagement = $quoteManagement;
52-
$this->quoteRepository = $quoteRepository;
5343
$this->quoteIdMaskFactory = $quoteIdMaskFactory;
5444
}
5545

@@ -84,16 +74,4 @@ public function placeOrder($cartId)
8474
$quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
8575
return $this->quoteManagement->placeOrder($quoteIdMask->getId());
8676
}
87-
88-
/**
89-
* {@inheritdoc}
90-
*/
91-
public function getCartForCustomer($customerId)
92-
{
93-
$cart = $this->quoteRepository->getActiveForCustomer($customerId);
94-
/** @var $quoteIdMask QuoteIdMask */
95-
$quoteIdMask = $this->quoteIdMaskFactory->create()->load($cart->getId(), 'masked_id');
96-
$cart->setId($quoteIdMask->getId());
97-
return $cart;
98-
}
9977
}

app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartManagementTest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ protected function setUp()
4747
true,
4848
[]
4949
);
50-
$this->quoteRepositoryMock = $this->getMock('Magento\Quote\Model\QuoteRepository', [], [], '', false);
5150
$this->quoteIdMaskFactoryMock = $this->getMock(
5251
'Magento\Quote\Model\QuoteIdMaskFactory',
5352
['create'],
@@ -67,7 +66,6 @@ protected function setUp()
6766
'Magento\Quote\Model\GuestCart\GuestCartManagement',
6867
[
6968
'quoteManagement' => $this->quoteManagementMock,
70-
'quoteRepository' => $this->quoteRepositoryMock,
7169
'quoteIdMaskFactory' => $this->quoteIdMaskFactoryMock
7270
]
7371
);
@@ -115,18 +113,4 @@ public function testPlaceOrder()
115113

116114
$this->assertEquals($orderId, $this->guestCartManagement->placeOrder($cartId));
117115
}
118-
119-
public function testGetCartForCustomer()
120-
{
121-
$maskedCartId = 'masked1cart2id3';
122-
$cartId = 1;
123-
$orderId = 1;
124-
125-
$this->quoteIdMaskMock->expects($this->once())->method('load')->with($cartId, 'masked_id')->willReturnSelf();
126-
$this->quoteIdMaskMock->expects($this->once())->method('getId')->willReturn($maskedCartId);
127-
$this->quoteIdMaskFactoryMock->expects($this->once())->method('create')->willReturn($this->quoteIdMaskMock);
128-
$this->quoteManagementMock->expects($this->once())->method('placeOrder')->willReturn($orderId);
129-
130-
$this->assertEquals($orderId, $this->guestCartManagement->placeOrder($cartId));
131-
}
132116
}

0 commit comments

Comments
 (0)