Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
use cases for rules tested.
James Coleb33ca786ae4d
diff --git a/app/TransactionRules/Actions/SetDestinationAccount.php b/app/TransactionRules/Actions/SetDestinationAccount.phpindex 2ba82a4c7e..1ad5fb1a46 100644--- a/app/TransactionRules/Actions/SetDestinationAccount.php+++ b/app/TransactionRules/Actions/SetDestinationAccount.php@@ -102,6 +102,9 @@ class SetDestinationAccount implements ActionInterface// update destination transaction with new destination account:// get destination transaction:$transaction = $journal->transactions()->where('amount', '>', 0)->first();+ if(null === $transaction) {+ return true;+ }$transaction->account_id = $this->newDestinationAccount->id;$transaction->save();$journal->touch();@@ -131,7 +134,7 @@ class SetDestinationAccount implements ActionInterface/****/- private function findExpenseAccount()+ private function findExpenseAccount(): void{$account = $this->repository->findByName($this->action->action_value, [AccountType::EXPENSE]);if (null === $account) {diff --git a/tests/Unit/Factory/TransactionCurrencyFactoryTest.php b/tests/Unit/Factory/TransactionCurrencyFactoryTest.phpindex 5c3a6e45ea..2805aba8cc 100644--- a/tests/Unit/Factory/TransactionCurrencyFactoryTest.php+++ b/tests/Unit/Factory/TransactionCurrencyFactoryTest.php@@ -92,6 +92,20 @@ class TransactionCurrencyFactoryTest extends TestCase$this->assertEquals($currency->id, $result->id);}+ /**+ * submit ID = 1000+ *+ * @covers \FireflyIII\Factory\TransactionCurrencyFactory+ */+ public function testFindByBadID(): void+ {+ $currency = TransactionCurrency::inRandomOrder()->whereNull('deleted_at')->first();+ /** @var TransactionCurrencyFactory $factory */+ $factory = app(TransactionCurrencyFactory::class);+ $result = $factory->find(1000, $currency->code);+ $this->assertEquals($currency->id, $result->id);+ }+/*** @covers \FireflyIII\Factory\TransactionCurrencyFactory*/