39 $this->scopeConfigMock = $this->getMockBuilder(\
Magento\Framework\
App\
Config\ScopeConfigInterface::class)
40 ->setMethods([
'getValue',
'isSetFlag'])
41 ->getMockForAbstractClass();
42 $this->methodInterfaceMock = $this->getMockBuilder(\
Magento\
Payment\Model\MethodInterface::class)
43 ->getMockForAbstractClass();
46 $this->config =
$om->getObject(
47 \
Magento\Paypal\Model\PayflowConfig::class,
49 'scopeConfig' => $this->scopeConfigMock
62 $this->scopeConfigMock->expects($this->any())
64 ->willReturn($paymentAction);
66 $this->assertEquals($expectedValue, $this->config->getTrxType());
89 $this->scopeConfigMock->expects($this->any())
91 ->willReturn($paymentAction);
93 $this->assertEquals($expectedValue, $this->config->getPaymentAction());
110 $this->scopeConfigMock->expects($this->never())
111 ->method(
'getValue');
112 $this->methodInterfaceMock->expects($this->once())
113 ->method(
'getConfigData')
114 ->with(
'transaction_url_test_mode')
115 ->willReturn(
'transaction_url_test_mode');
117 $this->config->setMethodInstance($this->methodInterfaceMock);
118 $this->assertEquals(
'transaction_url_test_mode', $this->config->getTransactionUrl(1));
123 $this->scopeConfigMock->expects($this->never())
124 ->method(
'getValue');
125 $this->methodInterfaceMock->expects($this->once())
126 ->method(
'getConfigData')
127 ->with(
'transaction_url')
128 ->willReturn(
'transaction_url');
130 $this->config->setMethodInstance($this->methodInterfaceMock);
131 $this->assertEquals(
'transaction_url', $this->config->getTransactionUrl(0));
136 $this->scopeConfigMock->expects($this->once())
139 $this->methodInterfaceMock->expects($this->once())
140 ->method(
'getConfigData')
141 ->with(
'transaction_url_test_mode')
142 ->willReturn(
'transaction_url_test_mode');
144 $this->config->setMethodInstance($this->methodInterfaceMock);
145 $this->assertEquals(
'transaction_url_test_mode', $this->config->getTransactionUrl());
150 $this->scopeConfigMock->expects($this->once())
153 $this->methodInterfaceMock->expects($this->once())
154 ->method(
'getConfigData')
155 ->with(
'transaction_url')
156 ->willReturn(
'transaction_url');
158 $this->config->setMethodInstance($this->methodInterfaceMock);
159 $this->assertEquals(
'transaction_url', $this->config->getTransactionUrl());
171 $this->config->setStoreId(5);
173 $this->scopeConfigMock->expects($this->any())
175 ->with(
'paypal/general/merchant_country')
176 ->will($this->returnValue(
'US'));
179 foreach ($expectsMethods as
$method => $isActive) {
180 $this->scopeConfigMock->expects($this->at(
$i++))
181 ->method(
'isSetFlag')
183 "payment/{$method}/active",
186 )->willReturn($isActive);
189 $this->assertEquals(
$result, $this->config->isMethodActive($currentMethod));
199 'expectsMethods' => [
207 'expectsMethods' => [
214 'expectsMethods' => [
218 'currentMethod' => 777,
testGetTransactionUrlWithTestModeOn()
dataProviderForTestIsMethodActive()
testGetTransactionUrlWithTestModeOff()
testGetPaymentAction($paymentAction, $expectedValue)
testGetTrxType($paymentAction, $expectedValue)
const PAYMENT_ACTION_AUTH
getPaymentActionDataProvider()
const PAYMENT_ACTION_SALE
const ACTION_AUTHORIZE_CAPTURE
testGetTransactionUrlWithTestModeEmptyAndSandboxOff()
testGetTransactionUrlWithTestModeEmptyAndSandboxOn()
testIsMethodActive(array $expectsMethods, $currentMethod, $result)