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

ParseDescriptionTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 83
Duplicated Lines 13.25 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 11
loc 83
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testDebitCredit() 11 11 1
A statementProvider() 0 59 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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