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

ParseTest::testParseStatementBank()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Kingsquare\Parser\Banking\Mt940\Engine\Abn;
4
5
use Kingsquare\Parser\Banking\Mt940\Engine\Abn;
6
7
/**
8
 *
9
 */
10
class ParseTest extends \PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * @var Abn
14
     */
15
    private $engine = null;
16
17
    protected function setUp()
18
    {
19
        $this->engine = new Abn();
20
        $this->engine->loadString(file_get_contents(__DIR__.'/sample'));
21
    }
22
23
    /**
24
     *
25
     */
26
    public function testParseStatementBank()
27
    {
28
        $method = new \ReflectionMethod($this->engine, 'parseStatementBank');
29
        $method->setAccessible(true);
30
        $this->assertEquals('ABN', $method->invoke($this->engine));
31
    }
32
33
    public function testParsesAllFoundStatements()
34
    {
35
        $statements = $this->engine->parse();
36
37
        $this->assertEquals(4, count($statements));
38
        $first = $statements[0];
39
        $last = end($statements);
40
41
        $this->assertEquals('23-06-2009', $first->getStartTimestamp('d-m-Y'));
42
        $this->assertEquals('24-06-2009', $first->getEndTimestamp('d-m-Y'));
43
        $this->assertEquals(210.5, $first->getDeltaPrice());
44
45
        $this->assertEquals('23-06-2009', $last->getStartTimestamp('d-m-Y'));
46
        $this->assertEquals('24-06-2009', $last->getEndTimestamp('d-m-Y'));
47
    }
48
}
49