12 class FreeTest extends \PHPUnit\Framework\TestCase
25 $paymentData = $this->createMock(\
Magento\
Payment\Helper\Data::class);
26 $this->scopeConfig = $this->createMock(\
Magento\Framework\
App\
Config\ScopeConfigInterface::class);
27 $this->currencyPrice = $this->getMockBuilder(\
Magento\Framework\Pricing\PriceCurrencyInterface::class)
30 $context = $this->createPartialMock(\
Magento\Framework\Model\Context::class, [
'getEventDispatcher']);
31 $eventManagerMock = $this->createMock(\
Magento\Framework\Event\ManagerInterface::class);
32 $context->expects($this->any())->method(
'getEventDispatcher')->willReturn($eventManagerMock);
36 $customAttributeFactory = $this->createMock(\
Magento\Framework\Api\AttributeValueFactory::class);
38 $loggerMock = $this->getMockBuilder(\
Magento\
Payment\Model\Method\Logger::class)
39 ->setConstructorArgs([$this->getMockForAbstractClass(\Psr\Log\LoggerInterface::class)])
42 $this->methodFree = new \Magento\Payment\Model\Method\Free(
46 $customAttributeFactory,
62 $this->scopeConfig->expects($this->at(0))
67 $this->scopeConfig->expects($this->at(1))
69 ->will($this->returnValue($paymentAction));
71 $this->assertEquals(
$result, $this->methodFree->getConfigPaymentAction());
85 $quote = $this->createMock(\
Magento\Quote\Model\Quote::class);
86 $quote->expects($this->any())
88 ->with($this->equalTo(
'getGrandTotal'))
89 ->will($this->returnValue($grandTotal));
92 $this->currencyPrice->expects($this->any())
94 ->willReturnArgument(0);
96 $this->scopeConfig->expects($this->any())
98 ->will($this->returnValue($isActive));
100 $this->assertEquals(
$result, $this->methodFree->isAvailable(
$quote));
109 [0,
true,
true,
true],
110 [0.1,
true,
true,
false],
111 [0,
false,
false,
false],
112 [1,
true,
false,
false],
113 [0,
true,
false,
false]
123 [
'pending',
'action',
null],
124 [
'processing',
'payment_action',
'payment_action']
testIsAvailable($grandTotal, $isActive, $notEmptyQuote, $result)
getConfigPaymentActionProvider()
testGetConfigPaymentAction($orderStatus, $paymentAction, $result)
$extensionAttributesFactory