Completed
Push — master ( f5773e...1d76e5 )
by Adelar
02:11
created

OfxParseTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 50 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 5
c 4
b 0
f 0
lcom 1
cbo 3
dl 29
loc 58
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A wrongXmlFormat() 0 5 1
A itau() 7 7 1
A santander() 7 7 1
A caixa() 7 7 1
A faturaCC() 8 8 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
namespace Adelarcubs\OFXParser;
3
4
use PHPUnit_Framework_TestCase;
5
use SimpleXMLElement;
6
use Adelarcubs\OFXParser\Ofx;
7
use Adelarcubs\OFXParser\OfxParser;
8
use Adelarcubs\OFXParser\OfxMovement;
9
10
/**
11
 *
12
 * @author Adelar Tiemann Junior <[email protected]>
13
 */
14
class OfxParseTest extends PHPUnit_Framework_TestCase
15
{
16
17
    /**
18
     * @test
19
     * @expectedException Exception
20
     */
21
    public function wrongXmlFormat()
22
    {
23
        $ofx = OfxParser::loadOfx('<OFX><root></rot></OFX>');
24
        $this->assertNull($ofx);
25
    }
26
27
    /**
28
     * @test
29
     */
30 View Code Duplication
    public function itau()
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...
31
    {
32
        $ofx = OfxParser::loadOfx(__DIR__ . '/fixtures/extrato_itau.ofx');
33
        $this->assertInstanceOf(Ofx::class, $ofx);
34
35
        $this->assertContainsOnlyInstancesOf(OfxMovement::class, $ofx->getMovements());
36
    }
37
38
    /**
39
     * @test
40
     */
41 View Code Duplication
    public function santander()
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...
42
    {
43
        $ofx = OfxParser::loadOfx(__DIR__ . '/fixtures/extrato_santander.ofx');
44
        $this->assertInstanceOf(Ofx::class, $ofx);
45
46
        $this->assertContainsOnlyInstancesOf(OfxMovement::class, $ofx->getMovements());
47
    }
48
49
    /**
50
     * @test
51
     */
52 View Code Duplication
    public function caixa()
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...
53
    {
54
        $ofx = OfxParser::loadOfx(__DIR__ . '/fixtures/extrato_caixa.ofx');
55
        $this->assertInstanceOf(Ofx::class, $ofx);
56
57
        $this->assertContainsOnlyInstancesOf(OfxMovement::class, $ofx->getMovements());
58
    }
59
60
    /**
61
     * @test
62
     */
63 View Code Duplication
    public function faturaCC()
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...
64
    {
65
        $ofx = OfxParser::loadOfx(__DIR__ . '/fixtures/fatura_cc_1.ofx');
66
67
        $this->assertInstanceOf(Ofx::class, $ofx);
68
69
        $this->assertContainsOnlyInstancesOf(OfxMovement::class, $ofx->getMovements());
70
    }
71
}
72