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

ParseTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testParseStatementBank() 0 6 1
A testParsesAllFoundStatements() 0 8 1
A testCorrectHandlingOfVariousStatementPricing() 0 7 1
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