Skip to content

Commit 3459162

Browse files
committed
Added assertion for logger
1 parent 31412e0 commit 3459162

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

app/code/Magento/Checkout/Test/Unit/Model/SessionTest.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,13 @@ public function testGetStepData()
382382
*/
383383
public function testGetQuote(): void
384384
{
385-
$quoteRepository = $this->createMock(\Magento\Quote\Api\CartRepositoryInterface::class);
386385
$storeManager = $this->getMockForAbstractClass(\Magento\Store\Model\StoreManagerInterface::class);
387386
$customerSession = $this->createMock(\Magento\Customer\Model\Session::class);
387+
$quoteRepository = $this->createMock(\Magento\Quote\Api\CartRepositoryInterface::class);
388388
$quoteFactory = $this->createMock(\Magento\Quote\Model\QuoteFactory::class);
389389
$quote = $this->createMock(\Magento\Quote\Model\Quote::class);
390+
$logger = $this->createMock(\Psr\Log\LoggerInterface::class);
391+
$loggerMethods = get_class_methods(\Psr\Log\LoggerInterface::class);
390392

391393
$quoteFactory->expects($this->once())
392394
->method('create')
@@ -403,14 +405,19 @@ public function testGetQuote(): void
403405
->will($this->returnValue($store));
404406
$storage = $this->getMockBuilder(\Magento\Framework\Session\Storage::class)
405407
->disableOriginalConstructor()
406-
->setMethods(['setData', 'getData'])
408+
->setMethods(['setData', 'getData'])
407409
->getMock();
408410
$storage->expects($this->at(0))
409411
->method('getData')
410412
->willReturn(1);
411413
$quoteRepository->expects($this->once())
412414
->method('getActiveForCustomer')
413-
->willThrowException(new NoSuchEntityException());
415+
->willThrowException(new NoSuchEntityException());
416+
417+
foreach ($loggerMethods as $method) {
418+
$logger->expects($this->never())->method($method);
419+
}
420+
414421
$quote->expects($this->once())
415422
->method('setCustomer')
416423
->with(null);
@@ -422,7 +429,8 @@ public function testGetQuote(): void
422429
'quoteRepository' => $quoteRepository,
423430
'customerSession' => $customerSession,
424431
'storage' => $storage,
425-
'quoteFactory' => $quoteFactory
432+
'quoteFactory' => $quoteFactory,
433+
'logger' => $logger
426434
]
427435
);
428436
$this->_session = $this->_helper->getObject(\Magento\Checkout\Model\Session::class, $constructArguments);

0 commit comments

Comments
 (0)