![]() 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-payment/Test/Unit/Model/Checks/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Payment\Test\Unit\Model\Checks; use Magento\Payment\Model\Checks\CanUseForCurrency; use Magento\Payment\Model\MethodInterface; use Magento\Quote\Model\Quote; use Magento\Store\Model\Store; use PHPUnit\Framework\TestCase; class CanUseForCurrencyTest extends TestCase { private const EXPECTED_CURRENCY_CODE = 'US'; /** * @var CanUseForCurrency */ protected $_model; protected function setUp(): void { $this->_model = new CanUseForCurrency(); } /** * @dataProvider paymentMethodDataProvider * @param bool $expectation */ public function testIsApplicable($expectation) { $paymentMethod = $this->getMockBuilder( MethodInterface::class )->disableOriginalConstructor() ->setMethods([])->getMock(); $paymentMethod->expects($this->once())->method('canUseForCurrency')->with( self::EXPECTED_CURRENCY_CODE )->willReturn($expectation); $quoteMock = $this->getMockBuilder(Quote::class) ->disableOriginalConstructor() ->setMethods( [] )->getMock(); $store = $this->getMockBuilder( Store::class )->disableOriginalConstructor() ->setMethods([])->getMock(); $store->expects($this->once())->method('getBaseCurrencyCode')->willReturn( self::EXPECTED_CURRENCY_CODE ); $quoteMock->expects($this->once())->method('getStore')->willReturn($store); $this->assertEquals($expectation, $this->_model->isApplicable($paymentMethod, $quoteMock)); } /** * @return array */ public function paymentMethodDataProvider() { return [[true], [false]]; } }