Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Protected Member Functions
DenyPaymentTest Class Reference
Inheritance diagram for DenyPaymentTest:

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 getProFactory ()
 
 getConfig ()
 

Detailed Description

@SuppressWarnings(PHPMD.CouplingBetweenObjects)

Definition at line 29 of file DenyPaymentTest.php.

Member Function Documentation

◆ getConfig()

getConfig ( )
protected

Gets config mock.

Returns
Config|MockObject

Definition at line 198 of file DenyPaymentTest.php.

199  {
200  $config = $this->getMockBuilder(Config::class)
201  ->disableOriginalConstructor()
202  ->getMock();
203  $config->method('getValue')
204  ->with('payment_action')
205  ->willReturn(Config::PAYMENT_ACTION_AUTH);
206 
207  return $config;
208  }
$config
Definition: fraud_order.php:17

◆ getProFactory()

getProFactory ( )
protected

Gets Pro factory mock.

Returns
ProFactory|MockObject

Definition at line 167 of file DenyPaymentTest.php.

168  {
169  $pro = $this->getMockBuilder(Pro::class)
170  ->disableOriginalConstructor()
171  ->setMethods(['getApi', 'setMethod', 'getConfig', '__wakeup', 'reviewPayment'])
172  ->getMock();
173  $nvpClient = $this->getMockBuilder(Nvp::class)
174  ->disableOriginalConstructor()
175  ->getMock();
176 
177  $pro->method('getConfig')
178  ->willReturn($this->getConfig());
179  $pro->method('getApi')
180  ->willReturn($nvpClient);
181  $pro->method('reviewPayment')
182  ->willReturn(true);
183 
184  $proFactory = $this->getMockBuilder(ProFactory::class)
185  ->disableOriginalConstructor()
186  ->getMock();
187  $proFactory->method('create')
188  ->willReturn($pro);
189 
190  return $proFactory;
191  }

◆ setUp()

setUp ( )
protected

Definition at line 54 of file DenyPaymentTest.php.

55  {
56  $this->objectManager = Bootstrap::getObjectManager();
57 
58  $this->apiClient = $this->getMockBuilder(ApiClient::class)
59  ->disableOriginalConstructor()
60  ->setMethods(['makeApiCall'])
61  ->getMock();
62 
63  $this->registry = $this->objectManager->get(Registry::class);
64 
65  $this->objectManager->addSharedInstance($this->apiClient, ApiClient::class);
66  }

◆ tearDown()

tearDown ( )
protected

Definition at line 71 of file DenyPaymentTest.php.

72  {
73  $this->objectManager->removeSharedInstance(ApiClient::class);
74  }

The documentation for this class was generated from the following file: