Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GuestCartTestHelper.php
Go to the documentation of this file.
1 <?php
8 
14 {
18  protected $testCase;
19 
25  public function __construct(\PHPUnit\Framework\TestCase $testCase)
26  {
27  $this->testCase = $testCase;
28  }
29 
39  public function mockQuoteIdMask($maskedCartId, $cartId)
40  {
41  $quoteIdMaskMock = $this->testCase->getMockBuilder(\Magento\Quote\Model\QuoteIdMask::class)
42  ->setMethods(['load', 'getQuoteId', 'getMaskedId'])
43  ->disableOriginalConstructor()
44  ->getMock();
45  $quoteIdMaskFactoryMock = $this->testCase->getMockBuilder(\Magento\Quote\Model\QuoteIdMaskFactory::class)
46  ->setMethods(['create'])
47  ->disableOriginalConstructor()
48  ->getMock();
49  $quoteIdMaskFactoryMock->expects($this->testCase->once())->method('create')->willReturn($quoteIdMaskMock);
50  $quoteIdMaskMock->expects($this->testCase->once())->method('load')->with($maskedCartId)->willReturnSelf();
51  $quoteIdMaskMock->expects($this->testCase->once())->method('getQuoteId')->willReturn($cartId);
52  return [$quoteIdMaskFactoryMock, $quoteIdMaskMock];
53  }
54 }
$cartId
Definition: quote.php:22