-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from fruitl00p/knab-fixes
KNAB fixes
- Loading branch information
Showing
3 changed files
with
127 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Kingsquare\Parser\Banking\Mt940\Engine\Knab; | ||
|
||
use Kingsquare\Parser\Banking\Mt940\Engine\Knab; | ||
|
||
/** | ||
* | ||
*/ | ||
class ParseTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var Knab | ||
*/ | ||
private $engine = null; | ||
|
||
protected function setUp() | ||
{ | ||
$this->engine = new Knab(); | ||
$this->engine->loadString(file_get_contents(__DIR__.'/sample')); | ||
} | ||
|
||
|
||
|
||
public function testParseStatementBank() | ||
{ | ||
$method = new \ReflectionMethod($this->engine, 'parseStatementBank'); | ||
$method->setAccessible(true); | ||
$this->assertEquals('KNAB', $method->invoke($this->engine)); | ||
} | ||
|
||
public function testParsesAllFoundStatements() | ||
{ | ||
$statements = $this->engine->parse(); | ||
|
||
$this->assertEquals(1, count($statements)); | ||
$this->assertEquals('03-12-2015', $statements[0]->getStartTimestamp('d-m-Y')); | ||
$this->assertEquals('03-12-2015', $statements[0]->getStartTimestamp('d-m-Y')); | ||
} | ||
|
||
public function testCorrectHandlingOfVariousStatementPricing() | ||
{ | ||
$statements = $this->engine->parse(); | ||
$this->assertEquals(1000.21, $statements[0]->getStartPrice()); | ||
$this->assertEquals(945.21, $statements[0]->getEndPrice()); | ||
$this->assertEquals(55, $statements[0]->getDeltaPrice()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{1:F01KNABNL2HAXXX0000000000}{2:I940KNABNL2HXXXXN3020}{4: | ||
:20:B5L04MSAU20N3I99 | ||
:25:0762918446 | ||
:28C:20/3 | ||
:60M:C151203EUR1000,21 | ||
:61:1512031203D15,NTRFNONREF | ||
:61:1512031203D15,NTRF03-12-2015 15:58 | ||
:86:61385002542767281000000000000000000 6676341986995664 TEST PURCHAS | ||
567890 | ||
REK: NL52RABO0326203011/NAAM: SOME NAME | ||
:61:1512031203D10,NTRFNONREF | ||
:86:03-12-2015 16:04 PAS: 1122 | ||
NAAM: ATM (DESCRIPTION) | ||
:61:1512031203D15,NTRFNONREF | ||
:86:03-12-2015 16:04 PAS: 1122 | ||
NAAM: POS | ||
:62M:C151203EUR945,21 | ||
-} |