Skip to content

Commit e56bc23

Browse files
author
Serhiy Shkolyarenko
committed
MAGETWO-49460: CartRepositoryInterface can't be used twice
updated fix
1 parent 522556b commit e56bc23

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

app/code/Magento/Quote/Model/QuoteRepository.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,22 +179,22 @@ protected function loadQuote($loadMethod, $loadField, $identifier, array $shared
179179
* Get quote collection
180180
* Temporary method to support release backward compatibility.
181181
*
182+
* @deprecated
182183
* @return QuoteCollection
183184
*/
184-
protected function resetQuoteCollection()
185+
protected function getQuoteCollection()
185186
{
187+
/** @var \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory $collectionFactory */
186188
$collectionFactory = ObjectManager::getInstance()->get(QuoteCollectionFactory::class);
187-
$this->quoteCollection = $collectionFactory->create();
188-
189-
return $this->quoteCollection;
189+
return $collectionFactory->create();
190190
}
191191

192192
/**
193193
* {@inheritdoc}
194194
*/
195195
public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria)
196196
{
197-
$this->quoteCollection = $this->resetQuoteCollection();
197+
$this->quoteCollection = $this->getQuoteCollection();
198198
/** @var \Magento\Quote\Api\Data\CartSearchResultsInterface $searchData */
199199
$searchData = $this->searchResultsDataFactory->create();
200200
$searchData->setSearchCriteria($searchCriteria);

app/code/Magento/Quote/Test/Unit/Model/QuoteRepositoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ public function testGetListSuccess($direction, $expectedDirection)
382382

383383
$this->model = $this->getMock(
384384
'Magento\Quote\Model\QuoteRepository',
385-
['resetQuoteCollection'],
385+
['getQuoteCollection'],
386386
[
387387
'quoteFactory' => $this->quoteFactoryMock,
388388
'storeManager' => $this->storeManagerMock,
@@ -391,7 +391,7 @@ public function testGetListSuccess($direction, $expectedDirection)
391391
'extensionAttributesJoinProcessor' => $this->extensionAttributesJoinProcessorMock
392392
]
393393
);
394-
$this->model->expects($this->once())->method('resetQuoteCollection')->willReturn($this->quoteCollectionMock);
394+
$this->model->expects($this->once())->method('getQuoteCollection')->willReturn($this->quoteCollectionMock);
395395
$this->assertEquals($searchResult, $this->model->getList($searchCriteriaMock));
396396
}
397397

0 commit comments

Comments
 (0)