mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Refactored a lot of tests.
This commit is contained in:
@@ -44,9 +44,9 @@ class AccountList implements BinderInterface
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
{
|
||||
Log::debug(sprintf('Now in AccountList::routeBinder("%s")', $value));
|
||||
//Log::debug(sprintf('Now in AccountList::routeBinder("%s")', $value));
|
||||
if (auth()->check()) {
|
||||
Log::debug('User is logged in.');
|
||||
//Log::debug('User is logged in.');
|
||||
$collection = new Collection;
|
||||
if ('allAssetAccounts' === $value) {
|
||||
/** @var Collection $collection */
|
||||
@@ -55,7 +55,7 @@ class AccountList implements BinderInterface
|
||||
->where('account_types.type', AccountType::ASSET)
|
||||
->orderBy('accounts.name', 'ASC')
|
||||
->get(['accounts.*']);
|
||||
Log::debug(sprintf('Collection length is %d', $collection->count()));
|
||||
//Log::debug(sprintf('Collection length is %d', $collection->count()));
|
||||
}
|
||||
if ('allAssetAccounts' !== $value) {
|
||||
$incoming = array_map('\intval', explode(',', $value));
|
||||
@@ -66,7 +66,7 @@ class AccountList implements BinderInterface
|
||||
->whereIn('accounts.id', $list)
|
||||
->orderBy('accounts.name', 'ASC')
|
||||
->get(['accounts.*']);
|
||||
Log::debug(sprintf('Collection length is %d', $collection->count()));
|
||||
//Log::debug(sprintf('Collection length is %d', $collection->count()));
|
||||
}
|
||||
|
||||
if ($collection->count() > 0) {
|
||||
|
@@ -43,12 +43,12 @@ class BudgetList implements BinderInterface
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
{
|
||||
Log::debug(sprintf('Now in BudgetList::routeBinder("%s")', $value));
|
||||
//Log::debug(sprintf('Now in BudgetList::routeBinder("%s")', $value));
|
||||
if (auth()->check()) {
|
||||
$list = array_unique(array_map('\intval', explode(',', $value)));
|
||||
Log::debug('List is now', $list);
|
||||
//Log::debug('List is now', $list);
|
||||
if (0 === count($list)) {
|
||||
Log::warning('List count is zero, return 404.');
|
||||
Log::warning('Budget list count is zero, return 404.');
|
||||
throw new NotFoundHttpException; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
@@ -57,22 +57,22 @@ class BudgetList implements BinderInterface
|
||||
->where('active', 1)
|
||||
->whereIn('id', $list)
|
||||
->get();
|
||||
Log::debug(sprintf('Found %d active budgets', $collection->count()), $list);
|
||||
//Log::debug(sprintf('Found %d active budgets', $collection->count()), $list);
|
||||
|
||||
// add empty budget if applicable.
|
||||
if (in_array(0, $list, true)) {
|
||||
Log::debug('Add empty budget because $list contains 0.');
|
||||
//Log::debug('Add empty budget because $list contains 0.');
|
||||
$collection->push(new Budget);
|
||||
}
|
||||
|
||||
if ($collection->count() > 0) {
|
||||
Log::debug(sprintf('List length is > 0 (%d), so return it.', $collection->count()));
|
||||
//Log::debug(sprintf('List length is > 0 (%d), so return it.', $collection->count()));
|
||||
|
||||
return $collection;
|
||||
}
|
||||
Log::debug('List length is zero, fall back to 404.');
|
||||
//Log::debug('List length is zero, fall back to 404.');
|
||||
}
|
||||
Log::debug('Final fallback to 404.');
|
||||
Log::warning('BudgetList fallback to 404.');
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user