Skip to content

Firefly III: a personal finances manager

Test for opening balance.

James Cole64ce53ac304b
diff --git a/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php b/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php
index 65b842871d..b3f6f5fd5c 100644
--- a/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php
+++ b/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php
@@ -382,7 +382,8 @@ class TransactionJournal implements TransactionJournalInterface, CUDInterface, C
}
}
break;
-
+ case (isset($model['from']) && isset($model['to'])):
+ break;
default:
throw new FireflyException('Cannot validate accounts for transaction journal.');
break;
diff --git a/tests/functional/AccountControllerCest.php b/tests/functional/AccountControllerCest.php
index 35ea055806..8848523ed6 100644
--- a/tests/functional/AccountControllerCest.php
+++ b/tests/functional/AccountControllerCest.php
@@ -114,6 +114,21 @@ class AccountControllerCest
$I->seeRecord('accounts', ['name' => 'New through tests.']);
}
+ /**
+ * @param FunctionalTester $I
+ */
+ public function storeOpeningBalance(FunctionalTester $I)
+ {
+ $I->amOnPage('/accounts/create/asset');
+ $I->wantTo('store a new asset account with a balance');
+ $I->see('Create a new asset account');
+ $I->submitForm('#store', ['name' => 'New through tests with balance.',
+ 'openingBalance' => 10,
+ 'openingBalanceDate' => '2015-01-01',
+ 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'store']);
+ $I->seeRecord('accounts', ['name' => 'New through tests with balance.']);
+ }
+
/**
* @param FunctionalTester $I
*/