Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SettlementTest.php
Go to the documentation of this file.
1 <?php
7 
8 class SettlementTest extends \PHPUnit\Framework\TestCase
9 {
13  public function testFetchAndSave()
14  {
17  \Magento\Paypal\Model\Report\Settlement::class
18  );
19  $connection = $this->createPartialMock(\Magento\Framework\Filesystem\Io\Sftp::class, ['rawls', 'read']);
20  $filename = 'STL-00000000.00.abc.CSV';
21  $connection->expects($this->once())->method('rawls')->will($this->returnValue([$filename => []]));
22  $connection->expects($this->once())->method('read')->with($filename, $this->anything());
23  $model->fetchAndSave($connection);
24  }
25 
32  {
34  }
35 
52  public function testGetSftpCredentials($automaticMode, $expectedResult)
53  {
56  \Magento\Paypal\Model\Report\Settlement::class
57  );
58 
59  $result = $model->getSftpCredentials($automaticMode);
60 
61  $this->assertEquals($expectedResult, $result);
62  }
63 
68  {
69  return [
70  [[]],
71  [['username' => 'test', 'password' => 'test', 'path' => '/']],
72  [['hostname' => 'example.com', 'password' => 'test', 'path' => '/']],
73  [['hostname' => 'example.com', 'username' => 'test', 'path' => '/']],
74  [['hostname' => 'example.com', 'username' => 'test', 'password' => 'test']]
75  ];
76  }
77 
82  {
83  return [
84  [
85  true,
86  [
87  [
88  'hostname' => '127.0.0.1',
89  'path' => '/tmp',
90  'username' => 'login',
91  'password' => 'password',
92  'sandbox' => '0'
93  ]
94  ]
95  ],
96  [
97  false,
98  [
99  [
100  'hostname' => '127.0.0.1',
101  'path' => '/tmp',
102  'username' => 'login',
103  'password' => 'password',
104  'sandbox' => '0'
105  ]
106  ]
107  ],
108  ];
109  }
110 }
$config
Definition: fraud_order.php:17
static createConnection(array $config)
Definition: Settlement.php:310
$connection
Definition: bulk.php:13