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

ParseDescriptionTest::statementProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 59
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 59
rs 9.597
cc 1
eloc 21
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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