mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 00:04:24 +00:00
Expand test coverage.
This commit is contained in:
@@ -44,19 +44,17 @@ class AssetAccountIbans implements MapperInterface
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($set as $account) {
|
||||
$iban = $account->iban ?? '';
|
||||
$iban = $account->iban ?? '';
|
||||
$accountId = intval($account->id);
|
||||
if (strlen($iban) > 0) {
|
||||
$topList[$account->id] = $account->iban . ' (' . $account->name . ')';
|
||||
$topList[$accountId] = $account->iban . ' (' . $account->name . ')';
|
||||
}
|
||||
if (0 === strlen($iban)) {
|
||||
$list[$account->id] = $account->name;
|
||||
$list[$accountId] = $account->name;
|
||||
}
|
||||
}
|
||||
asort($topList);
|
||||
asort($list);
|
||||
|
||||
$list = $topList + $list;
|
||||
$list = [0 => trans('import.map_do_not_map')] + $list;
|
||||
$list = array_merge($topList, $list);
|
||||
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
@@ -43,17 +43,15 @@ class AssetAccounts implements MapperInterface
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($set as $account) {
|
||||
$name = $account->name;
|
||||
$iban = $account->iban ?? '';
|
||||
$accountId = intval($account->id);
|
||||
$name = $account->name;
|
||||
$iban = $account->iban ?? '';
|
||||
if (strlen($iban) > 0) {
|
||||
$name .= ' (' . $account->iban . ')';
|
||||
$name .= ' (' . $iban . ')';
|
||||
}
|
||||
$list[$account->id] = $name;
|
||||
$list[$accountId] = $name;
|
||||
}
|
||||
|
||||
asort($list);
|
||||
|
||||
$list = [0 => trans('import.map_do_not_map')] + $list;
|
||||
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
@@ -42,11 +42,10 @@ class Bills implements MapperInterface
|
||||
|
||||
/** @var Bill $bill */
|
||||
foreach ($result as $bill) {
|
||||
$list[$bill->id] = $bill->name . ' [' . $bill->match . ']';
|
||||
$billId = intval($bill->id);
|
||||
$list[$billId] = $bill->name . ' [' . $bill->match . ']';
|
||||
}
|
||||
asort($list);
|
||||
|
||||
$list = [0 => trans('import.map_do_not_map')] + $list;
|
||||
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
@@ -37,16 +37,15 @@ class Budgets implements MapperInterface
|
||||
{
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app(BudgetRepositoryInterface::class);
|
||||
$result = $repository->getBudgets();
|
||||
$result = $repository->getActiveBudgets();
|
||||
$list = [];
|
||||
|
||||
/** @var Budget $budget */
|
||||
foreach ($result as $budget) {
|
||||
$list[$budget->id] = $budget->name;
|
||||
$budgetId = intval($budget->id);
|
||||
$list[$budgetId] = $budget->name;
|
||||
}
|
||||
asort($list);
|
||||
|
||||
$list = [0 => trans('import.map_do_not_map')] + $list;
|
||||
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
@@ -42,11 +42,10 @@ class Categories implements MapperInterface
|
||||
|
||||
/** @var Category $category */
|
||||
foreach ($result as $category) {
|
||||
$list[$category->id] = $category->name;
|
||||
$categoryId = intval($category->id);
|
||||
$list[$categoryId] = $category->name;
|
||||
}
|
||||
asort($list);
|
||||
|
||||
$list = [0 => trans('import.map_do_not_map')] + $list;
|
||||
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
@@ -50,19 +50,17 @@ class OpposingAccountIbans implements MapperInterface
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($set as $account) {
|
||||
$iban = $account->iban ?? '';
|
||||
$iban = $account->iban ?? '';
|
||||
$accountId = intval($account->id);
|
||||
if (strlen($iban) > 0) {
|
||||
$topList[$account->id] = $account->iban . ' (' . $account->name . ')';
|
||||
$topList[$accountId] = $account->iban . ' (' . $account->name . ')';
|
||||
}
|
||||
if (0 === strlen($iban)) {
|
||||
$list[$account->id] = $account->name;
|
||||
$list[$accountId] = $account->name;
|
||||
}
|
||||
}
|
||||
asort($topList);
|
||||
asort($list);
|
||||
|
||||
$list = $topList + $list;
|
||||
$list = [0 => trans('import.map_do_not_map')] + $list;
|
||||
$list = array_merge($topList, $list);
|
||||
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
@@ -49,17 +49,15 @@ class OpposingAccounts implements MapperInterface
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($set as $account) {
|
||||
$name = $account->name;
|
||||
$iban = $account->iban ?? '';
|
||||
$accountId = intval($account->id);
|
||||
$name = $account->name;
|
||||
$iban = $account->iban ?? '';
|
||||
if (strlen($iban) > 0) {
|
||||
$name .= ' (' . $account->iban . ')';
|
||||
$name .= ' (' . $iban . ')';
|
||||
}
|
||||
$list[$account->id] = $name;
|
||||
$list[$accountId] = $name;
|
||||
}
|
||||
|
||||
asort($list);
|
||||
|
||||
$list = [0 => trans('import.map_do_not_map')] + $list;
|
||||
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
@@ -42,11 +42,10 @@ class Tags implements MapperInterface
|
||||
|
||||
/** @var Tag $tag */
|
||||
foreach ($result as $tag) {
|
||||
$list[$tag->id] = $tag->tag;
|
||||
$tagId = intval($tag->id);
|
||||
$list[$tagId] = $tag->tag;
|
||||
}
|
||||
asort($list);
|
||||
|
||||
$list = [0 => trans('import.map_do_not_map')] + $list;
|
||||
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Import\Mapper;
|
||||
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
|
||||
/**
|
||||
* Class TransactionCurrencies.
|
||||
@@ -34,15 +34,16 @@ class TransactionCurrencies implements MapperInterface
|
||||
*/
|
||||
public function getMap(): array
|
||||
{
|
||||
$currencies = TransactionCurrency::get();
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
$currencies = $repository->get();
|
||||
$list = [];
|
||||
foreach ($currencies as $currency) {
|
||||
$list[$currency->id] = $currency->name . ' (' . $currency->code . ')';
|
||||
$currencyId = intval($currency->id);
|
||||
$list[$currencyId] = $currency->name . ' (' . $currency->code . ')';
|
||||
}
|
||||
|
||||
asort($list);
|
||||
|
||||
$list = [0 => trans('import.map_do_not_map')] + $list;
|
||||
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
Reference in New Issue
Block a user