Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Tests now run without a database, as they should.
James Cole720926c50dce
diff --git a/app/Support/Amount.php b/app/Support/Amount.phpindex 115392eb1f..aed7c6bfcb 100644--- a/app/Support/Amount.php+++ b/app/Support/Amount.php@@ -6,6 +6,7 @@ use Cache;use FireflyIII\Models\Transaction;use FireflyIII\Models\TransactionCurrency;use FireflyIII\Models\TransactionJournal;+use Illuminate\Support\Collection;use Preferences as Prefs;/**@@ -134,6 +135,14 @@ class Amountreturn $this->formatWithSymbol($symbol, $amount, $coloured);}+ /**+ * @return Collection+ */+ public function getAllCurrencies()+ {+ return TransactionCurrency::orderBy('code', 'ASC')->get();+ }+/*** @return string*/diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.phpindex 4ef41d059b..eb82ceb247 100644--- a/app/Support/ExpandedForm.php+++ b/app/Support/ExpandedForm.php@@ -34,7 +34,7 @@ class ExpandedForm$options['step'] = 'any';$options['min'] = '0.01';$defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();- $currencies = TransactionCurrency::orderBy('code', 'ASC')->get();+ $currencies = Amt::getAllCurrencies();$html = View::make('form.amount', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();return $html;@@ -63,7 +63,7 @@ class ExpandedForm'budget_id' => 'Budget','openingBalance' => 'Opening balance','virtualBalance' => 'Virtual balance',- 'targetamount' => 'Target amount',+ 'targetamount' => 'Target amount','accountRole' => 'Account role','openingBalanceDate' => 'Opening balance date','piggy_bank_id' => 'Piggy bank'];@@ -145,7 +145,7 @@ class ExpandedForm$value = $this->fillFieldValue($name, $value);$options['step'] = 'any';$defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();- $currencies = TransactionCurrency::orderBy('code', 'ASC')->get();+ $currencies = Amt::getAllCurrencies();$html = View::make('form.balance', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();return $html;diff --git a/tests/controllers/AccountControllerTest.php b/tests/controllers/AccountControllerTest.phpindex a6e7d76f43..e25811193d 100644--- a/tests/controllers/AccountControllerTest.php+++ b/tests/controllers/AccountControllerTest.php@@ -14,7 +14,6 @@ class AccountControllerTest extends TestCasepublic function setUp(){parent::setUp();- Artisan::call('migrate');}@@ -42,6 +41,8 @@ class AccountControllerTest extends TestCasePreferences::shouldReceive('get', 'viewRange')->andReturn($pref);Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);+ Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);+ // get all currencires?$response = $this->call('GET', '/accounts/create/asset');$this->assertResponseOk();