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

Protected Member Functions

 setUp ()
 
 getConfig ()
 
 getProFactory ()
 

Detailed Description

Definition at line 21 of file HostedproTest.php.

Member Function Documentation

◆ getConfig()

getConfig ( )
protected

Get mock for config

Returns
\PHPUnit_Framework_MockObject_MockObject

Definition at line 86 of file HostedproTest.php.

87  {
88  $config = $this->getMockBuilder(Config::class)
89  ->disableOriginalConstructor()
90  ->setMethods(['getValue'])
91  ->getMock();
92  $config->expects(static::any())
93  ->method('getValue')
94  ->with('payment_action')
95  ->willReturn(Config::PAYMENT_ACTION_AUTH);
96  return $config;
97  }
$config
Definition: fraud_order.php:17

◆ getProFactory()

getProFactory ( )
protected

Create mock for Pro factory

Returns
\PHPUnit_Framework_MockObject_MockObject

Definition at line 103 of file HostedproTest.php.

104  {
105  $pro = $this->getMockBuilder(Pro::class)
106  ->disableOriginalConstructor()
107  ->setMethods(['getApi', 'setMethod', 'getConfig', '__wakeup'])
108  ->getMock();
109 
110  $config = $this->getConfig();
111  $pro->expects(static::any())
112  ->method('getConfig')
113  ->willReturn($config);
114  $pro->expects(static::any())
115  ->method('getApi')
116  ->willReturn($this->api);
117 
118  $proFactory = $this->getMockBuilder(ProFactory::class)
119  ->disableOriginalConstructor()
120  ->setMethods(['create'])
121  ->getMock();
122  $proFactory->expects(static::once())
123  ->method('create')
124  ->willReturn($pro);
125  return $proFactory;
126  }
$config
Definition: fraud_order.php:17

◆ setUp()

setUp ( )
protected

Definition at line 38 of file HostedproTest.php.

39  {
40  $this->objectManager = Bootstrap::getObjectManager();
41 
42  $this->api = $this->getMockBuilder(Nvp::class)
43  ->disableOriginalConstructor()
44  ->setMethods(['call'])
45  ->getMock();
46 
47  $proFactory = $this->getProFactory();
48 
49  $this->model = $this->objectManager
50  ->create(Hostedpro::class, [
51  'proFactory' => $proFactory
52  ]);
53  }

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