Completed
Push — master ( 26e69a...ab0b77 )
by Robin
03:27
created

ParseDescriptionTest::testDebitCredit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 11
Ratio 100 %
Metric Value
dl 11
loc 11
rs 9.4285
cc 1
eloc 8
nc 1
nop 2
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 View Code Duplication
    public function testDebitCredit($input, $expected)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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