|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Kingsquare\Parser\Banking\Mt940\Engine; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* |
|
7
|
|
|
*/ |
|
8
|
|
|
class ParseTransactionPriceTest extends \PHPUnit_Framework_TestCase |
|
9
|
|
|
{ |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* @dataProvider getTransactions |
|
13
|
|
|
* |
|
14
|
|
|
* @param $inputString |
|
15
|
|
|
* @param $expected |
|
16
|
|
|
* @throws \ReflectionException |
|
17
|
|
|
*/ |
|
18
|
|
|
public function test($inputString, $expected) { |
|
19
|
|
|
$engine = new Unknown(); |
|
20
|
|
|
$property = new \ReflectionProperty($engine, 'currentTransactionData'); |
|
21
|
|
|
$property->setAccessible(true); |
|
22
|
|
|
$property->setValue($engine, $inputString); |
|
23
|
|
|
|
|
24
|
|
|
$method = new \ReflectionMethod($engine, 'parseTransactionPrice'); |
|
25
|
|
|
$method->setAccessible(true); |
|
26
|
|
|
$this->assertSame($expected, $method->invoke($engine)); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function getTransactions() |
|
30
|
|
|
{ |
|
31
|
|
|
return [ |
|
32
|
|
|
'sample-ABN' => [':61:0906240625D1027,91N422NONREF', 1027.91], |
|
33
|
|
|
'sample-Ing' => [':61:100722C25,03NOV NONREF', 25.03], |
|
34
|
|
|
'sample-Rabo' => [':61:030111D000000000500.00NMSC1173113681 ROBECO', 500.00], |
|
35
|
|
|
'sample-Spk' => [':61:1002170217C10,N0520000000000000002', 10.00], |
|
36
|
|
|
'sample-Tri' => [':61:1002170217C10,N0520000000000000002', 10.00], |
|
37
|
|
|
'sample-Unknown' => [':61:1002170217C10,N0520000000000000002', 10.00], |
|
38
|
|
|
'issue-53-withMultiple-CD-chars' => [':61:1807300730D28,5N132000002018827922//B8G30PGA01UD901N', 28.50], |
|
39
|
|
|
]; |
|
40
|
|
|
} |
|
41
|
|
|
} |