Completed
Push — ing-descriptions ( 0564d5 )
by Robin
02:48
created

ParseTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testParsesAllFoundStatements() 0 10 1
A setUp() 0 4 1
A testParseStatementBank() 0 5 1
A testSanitizeDescription() 0 5 1
1
<?php
2
3
namespace Kingsquare\Parser\Banking\Mt940\Engine\Ing;
4
5
use Kingsquare\Parser\Banking\Mt940\Engine\Ing;
6
7
/**
8
 *
9
 */
10
class ParseTest extends \PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * @var Ing
14
     */
15
    private $engine;
16
17
    protected function setUp()
18
    {
19
        $this->engine = new Ing();
20
        $this->engine->loadString(file_get_contents(__DIR__.'/sample'));
21
    }
22
23
    public function testParseStatementBank()
24
    {
25
        $method = new \ReflectionMethod($this->engine, 'parseStatementBank');
26
        $method->setAccessible(true);
27
        $this->assertEquals('ING', $method->invoke($this->engine));
28
    }
29
30
    public function testParsesAllFoundStatements()
31
    {
32
        $statements = $this->engine->parse();
33
34
        $this->assertCount(1, $statements);
35
        $first = $statements[0];
36
37
        $this->assertEquals('22-07-2010', $first->getStartTimestamp('d-m-Y'));
38
        $this->assertEquals('23-07-2010', $first->getEndTimestamp('d-m-Y'));
39
        $this->assertEquals(-3.47, $first->getDeltaPrice());
40
    }
41
42
    /**
43
     * @TODO this is WIP, add more!
44
     */
45
    public function testSanitizeDescription()
46
    {
47
        $statements = $this->engine->parse();
48
        $first = $statements[0]->getTransactions()[0];
49
        $this->assertEquals('', $first->getDescription());
50
51
    }
52
}
53