Completed
Push — knab-fixes ( 36afaf )
by Robin
05:28
created

testCorrectHandlingOfVariousStatementPricing()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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