From ea2c48bca52d6f4b0c6aa9e3ba72a4806bceb4b9 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 22 Jul 2018 17:06:10 +0200 Subject: [PATCH] Fix tests. --- app/Http/Controllers/Chart/AccountController.php | 10 +++++++--- app/Models/Bill.php | 4 ++-- app/Models/Budget.php | 4 ++-- app/Models/Category.php | 4 ++-- app/Models/PiggyBank.php | 4 ++-- app/Models/Tag.php | 4 ++-- app/Models/TransactionJournal.php | 4 ++-- app/Rules/IsAssetAccountId.php | 2 +- 8 files changed, 20 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php index b326c9272e..10923b03a5 100644 --- a/app/Http/Controllers/Chart/AccountController.php +++ b/app/Http/Controllers/Chart/AccountController.php @@ -467,10 +467,14 @@ class AccountController extends Controller /** @var CurrencyRepositoryInterface $repository */ $repository = app(CurrencyRepositoryInterface::class); - $default = app('amount')->getDefaultCurrency(); - $chartData = []; + /** @var AccountRepositoryInterface $accountRepos */ + $accountRepos = app(AccountRepositoryInterface::class); + + $default = app('amount')->getDefaultCurrency(); + $chartData = []; + /** @var Account $account */ foreach ($accounts as $account) { - $currency = $repository->findNull((int)$account->getMeta('currency_id')); + $currency = $repository->findNull((int)$accountRepos->getMetaValue($account, 'currency_id')); if (null === $currency) { $currency = $default; } diff --git a/app/Models/Bill.php b/app/Models/Bill.php index 3560800ec6..99a30828e5 100644 --- a/app/Models/Bill.php +++ b/app/Models/Bill.php @@ -139,10 +139,10 @@ class Bill extends Model * * @param $value * - * @return string + * @return string|null * @throws \Illuminate\Contracts\Encryption\DecryptException */ - public function getNameAttribute($value): string + public function getNameAttribute($value): ?string { if (1 === (int)$this->name_encrypted) { return Crypt::decrypt($value); diff --git a/app/Models/Budget.php b/app/Models/Budget.php index b6c29ae3ed..6838945741 100644 --- a/app/Models/Budget.php +++ b/app/Models/Budget.php @@ -96,10 +96,10 @@ class Budget extends Model * * @param $value * - * @return string + * @return string|null * @throws \Illuminate\Contracts\Encryption\DecryptException */ - public function getNameAttribute($value): string + public function getNameAttribute($value): ?string { if ($this->encrypted) { return Crypt::decrypt($value); diff --git a/app/Models/Category.php b/app/Models/Category.php index a9cdb27bce..b8ea97894d 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -85,10 +85,10 @@ class Category extends Model * * @param $value * - * @return string + * @return string|null * @throws \Illuminate\Contracts\Encryption\DecryptException */ - public function getNameAttribute($value): string + public function getNameAttribute($value): ?string { if ($this->encrypted) { return Crypt::decrypt($value); diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index 9a07f79175..d6779aef84 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -107,10 +107,10 @@ class PiggyBank extends Model * * @param $value * - * @return string + * @return string|null * @throws \Illuminate\Contracts\Encryption\DecryptException */ - public function getNameAttribute($value): string + public function getNameAttribute($value): ?string { if ($this->encrypted) { return Crypt::decrypt($value); diff --git a/app/Models/Tag.php b/app/Models/Tag.php index ef97718a6e..2d2ddc7758 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -85,10 +85,10 @@ class Tag extends Model * * @param $value * - * @return string + * @return string|null * @throws \Illuminate\Contracts\Encryption\DecryptException */ - public function getDescriptionAttribute($value): string + public function getDescriptionAttribute($value): ?string { if (null === $value) { return $value; diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index 2501343b4d..7a6a1e1ada 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -153,10 +153,10 @@ class TransactionJournal extends Model * * @param $value * - * @return string + * @return string|null * @throws \Illuminate\Contracts\Encryption\DecryptException */ - public function getDescriptionAttribute($value): string + public function getDescriptionAttribute($value): ?string { if ($this->encrypted) { return Crypt::decrypt($value); diff --git a/app/Rules/IsAssetAccountId.php b/app/Rules/IsAssetAccountId.php index 7ffa717037..b072784b0b 100644 --- a/app/Rules/IsAssetAccountId.php +++ b/app/Rules/IsAssetAccountId.php @@ -1,6 +1,6 @@