![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-quote/Test/Unit/Model/GuestCart/ |
<?php /** * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Quote\Test\Unit\Model\GuestCart; use Magento\Quote\Model\QuoteIdMask; use Magento\Quote\Model\QuoteIdMaskFactory; use PHPUnit\Framework\TestCase; class GuestCartTestHelper { /** * @var TestCase */ protected $testCase; /** * Initialize helper * * @param TestCase $testCase */ public function __construct(TestCase $testCase) { $this->testCase = $testCase; } /** * Return mocks with expected invokes * * First element is quoteIdMaskFactoryMock, second one is quoteIdMaskMock * * @param $maskedCartId * @param $cartId * @return array */ public function mockQuoteIdMask($maskedCartId, $cartId) { $quoteIdMaskMock = $this->testCase->getMockBuilder(QuoteIdMask::class) ->setMethods(['load', 'getQuoteId', 'getMaskedId']) ->disableOriginalConstructor() ->getMock(); $quoteIdMaskFactoryMock = $this->testCase->getMockBuilder(QuoteIdMaskFactory::class) ->setMethods(['create']) ->disableOriginalConstructor() ->getMock(); $quoteIdMaskFactoryMock->expects($this->testCase->once())->method('create')->willReturn($quoteIdMaskMock); $quoteIdMaskMock->expects($this->testCase->once())->method('load')->with($maskedCartId)->willReturnSelf(); $quoteIdMaskMock->expects($this->testCase->once())->method('getQuoteId')->willReturn($cartId); return [$quoteIdMaskFactoryMock, $quoteIdMaskMock]; } }