Fix tests.

This commit is contained in:
James Cole
2018-07-22 17:06:10 +02:00
parent a722dc4235
commit ea2c48bca5
8 changed files with 20 additions and 16 deletions

View File

@@ -467,10 +467,14 @@ class AccountController extends Controller
/** @var CurrencyRepositoryInterface $repository */ /** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class); $repository = app(CurrencyRepositoryInterface::class);
$default = app('amount')->getDefaultCurrency(); /** @var AccountRepositoryInterface $accountRepos */
$chartData = []; $accountRepos = app(AccountRepositoryInterface::class);
$default = app('amount')->getDefaultCurrency();
$chartData = [];
/** @var Account $account */
foreach ($accounts as $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) { if (null === $currency) {
$currency = $default; $currency = $default;
} }

View File

@@ -139,10 +139,10 @@ class Bill extends Model
* *
* @param $value * @param $value
* *
* @return string * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException * @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getNameAttribute($value): string public function getNameAttribute($value): ?string
{ {
if (1 === (int)$this->name_encrypted) { if (1 === (int)$this->name_encrypted) {
return Crypt::decrypt($value); return Crypt::decrypt($value);

View File

@@ -96,10 +96,10 @@ class Budget extends Model
* *
* @param $value * @param $value
* *
* @return string * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException * @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getNameAttribute($value): string public function getNameAttribute($value): ?string
{ {
if ($this->encrypted) { if ($this->encrypted) {
return Crypt::decrypt($value); return Crypt::decrypt($value);

View File

@@ -85,10 +85,10 @@ class Category extends Model
* *
* @param $value * @param $value
* *
* @return string * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException * @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getNameAttribute($value): string public function getNameAttribute($value): ?string
{ {
if ($this->encrypted) { if ($this->encrypted) {
return Crypt::decrypt($value); return Crypt::decrypt($value);

View File

@@ -107,10 +107,10 @@ class PiggyBank extends Model
* *
* @param $value * @param $value
* *
* @return string * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException * @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getNameAttribute($value): string public function getNameAttribute($value): ?string
{ {
if ($this->encrypted) { if ($this->encrypted) {
return Crypt::decrypt($value); return Crypt::decrypt($value);

View File

@@ -85,10 +85,10 @@ class Tag extends Model
* *
* @param $value * @param $value
* *
* @return string * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException * @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getDescriptionAttribute($value): string public function getDescriptionAttribute($value): ?string
{ {
if (null === $value) { if (null === $value) {
return $value; return $value;

View File

@@ -153,10 +153,10 @@ class TransactionJournal extends Model
* *
* @param $value * @param $value
* *
* @return string * @return string|null
* @throws \Illuminate\Contracts\Encryption\DecryptException * @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getDescriptionAttribute($value): string public function getDescriptionAttribute($value): ?string
{ {
if ($this->encrypted) { if ($this->encrypted) {
return Crypt::decrypt($value); return Crypt::decrypt($value);

View File

@@ -1,6 +1,6 @@
<?php <?php
namespace FireflyIII\Rules; namespace FireflyIII\TransactionRules\Triggers;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType; use FireflyIII\Models\AccountType;