ParseDescriptionTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 45
dl 0
loc 79
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testDebitCredit() 0 10 1
A statementProvider() 0 56 1
1
<?php
2
3
namespace Kingsquare\Parser\Banking\Mt940\Engine;
4
5
/**
6
 *
7
 */
8
class ParseDescriptionTest extends \PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * @dataProvider statementProvider
12
     *
13
     * @param $input
14
     * @param $expected
15
     */
16
    public function testDebitCredit($input, $expected)
17
    {
18
        $engine = new Unknown();
19
        $property = new \ReflectionProperty($engine, 'currentTransactionData');
20
        $property->setAccessible(true);
21
        $property->setValue($engine, $input);
22
23
        $method = new \ReflectionMethod($engine, 'parseTransactionDescription');
24
        $method->setAccessible(true);
25
        $this->assertEquals($expected, $method->invoke($engine));
26
    }
27
28
    /**
29
     * @return array
30
     */
31
    public function statementProvider()
32
    {
33
        return [
34
                [':86:This is a test', ''],
35
                [
36
                        '
37
:86:This is a test',
38
                        'This is a test',
39
                ],
40
                [
41
                        '
42
:86:This is a test
43
',
44
                        'This is a test',
45
                ],
46
                [
47
                        '
48
:86:This is a test
49
:',
50
                        'This is a test:',
51
                ],
52
                [
53
                        '
54
:86:This is a test
55
:6',
56
                        'This is a test:6',
57
                ],
58
                [
59
                        '
60
:86:This is a test
61
:61',
62
                        'This is a test',
63
                ],
64
                [
65
                        '
66
:86:This is a test
67
:62',
68
                        'This is a test',
69
                ],
70
                [
71
                        '
72
:86:This is a test
73
: 62',
74
                        'This is a test: 62',
75
                ],
76
                [
77
                        '
78
:86:Spaarpot kantine',
79
                        'Spaarpot kantine',
80
                ],
81
                [
82
                        '
83
:86: ABN AMRO BANK>AMSTERDAM S1P468
84
22­07­2010 09:57 002 5595781
85
',
86
                        'ABN AMRO BANK>AMSTERDAM S1P46822­07­2010 09:57 002 5595781',
87
                ],
88
        ];
89
    }
90
}
91