Skip to content

Commit

Permalink
add test for getBalances
Browse files Browse the repository at this point in the history
  • Loading branch information
grummbeer committed Dec 10, 2023
1 parent bb1fb9f commit 91a4606
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tests/ContextXmlRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
/**
* @covers \AqBanking\ContextXmlRenderer
* @uses \AqBanking\ContentXmlRenderer\MoneyElementRenderer
* @uses \AqBanking\Balance
*/
class ContextXmlRendererTest extends TestCase
{
Expand Down Expand Up @@ -78,9 +79,22 @@ public function testCanRenderTransactions()
$this->assertEquals($expectedTransactions, $sut->getTransactions());
}

/**
* @throws Exception
*/
public function testCanRenderBalances()
{
$fixture = file_get_contents(__DIR__ . '/fixtures/test_context_file_transactions.xml');
$domDocument = new \DOMDocument();
$domDocument->loadXML($fixture);

$sut = new ContextXmlRenderer($domDocument);

$balances = $sut->getBalances();

$this->assertCount(3, $balances);
$this->assertInstanceOf(\DateTime::class, $balances[0]->getDate());
$this->assertInstanceOf(Money::class, $balances[0]->getValue());
$this->assertSame('temporary', $balances[0]->getType());
}

public function testThrowsExceptionIfDataContainsReservedChar()
{
$fixture = file_get_contents(__DIR__ . '/fixtures/test_context_file_transactions_with_reserved_char.xml');
Expand Down

0 comments on commit 91a4606

Please sign in to comment.