Passed
Push — master ( 7fc1c6...790207 )
by Adelar
04:53
created

OfxParseTest::itauIso()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 8
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
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
        $this->assertInternalType('array', $ofx->jsonSerialize());
35
36
        $this->assertContainsOnlyInstancesOf(OfxMovement::class, $ofx->getMovements());
37
    }
38
39
    /**
40
     * @test
41
     */
42 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...
43
    {
44
        $ofx = OfxParser::loadOfx(__DIR__ . '/fixtures/extrato_santander.ofx');
45
        $this->assertInstanceOf(Ofx::class, $ofx);
46
        $this->assertInternalType('array', $ofx->jsonSerialize());
47
48
        $this->assertContainsOnlyInstancesOf(OfxMovement::class, $ofx->getMovements());
49
    }
50
51
    /**
52
     * @test
53
     */
54 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...
55
    {
56
        $ofx = OfxParser::loadOfx(__DIR__ . '/fixtures/extrato_caixa.ofx');
57
        $this->assertInstanceOf(Ofx::class, $ofx);
58
        $this->assertInternalType('array', $ofx->jsonSerialize());
59
60
        $this->assertContainsOnlyInstancesOf(OfxMovement::class, $ofx->getMovements());
61
    }
62
63
    /**
64
     * @test
65
     */
66 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...
67
    {
68
        $ofx = OfxParser::loadOfx(__DIR__ . '/fixtures/fatura_cc_1.ofx');
69
        $this->assertInstanceOf(Ofx::class, $ofx);
70
        $this->assertInternalType('array', $ofx->jsonSerialize());
71
72
        $this->assertContainsOnlyInstancesOf(OfxMovement::class, $ofx->getMovements());
73
    }
74
75
    /**
76
     * @test
77
     */
78 View Code Duplication
    public function itauIso()
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...
79
    {
80
        $ofx = OfxParser::loadOfx(__DIR__ . '/fixtures/extrato_itau_iso.ofx');
81
        $this->assertInstanceOf(Ofx::class, $ofx);
82
        $this->assertInternalType('array', $ofx->jsonSerialize());
83
84
        $this->assertContainsOnlyInstancesOf(OfxMovement::class, $ofx->getMovements());
85
    }
86
}
87