mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Improve test coverage and fix test code.
This commit is contained in:
@@ -154,7 +154,7 @@ class AvailableBudgetController extends Controller
|
||||
$data = $request->getAll();
|
||||
$currency = $this->currencyRepository->findNull($data['currency_id']);
|
||||
if (null === $currency) {
|
||||
$this->currencyRepository->findByCodeNull($data['currency_code']);
|
||||
$currency = $this->currencyRepository->findByCodeNull($data['currency_code']);
|
||||
}
|
||||
if (null === $currency) {
|
||||
throw new FireflyException('Could not find the indicated currency.');
|
||||
@@ -169,6 +169,8 @@ class AvailableBudgetController extends Controller
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
|
@@ -161,7 +161,7 @@ class PiggyBankController extends Controller
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
throw new FireflyException('Could not store new piggy bank.'); // @codeCoverageIgnore
|
||||
throw new FireflyException('Could not store new piggy bank.');
|
||||
|
||||
}
|
||||
|
||||
|
@@ -101,7 +101,7 @@ class RuleController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$paginator = new LengthAwarePaginator($rules, $count, $pageSize, $this->parameters->get('page'));
|
||||
$paginator->setPath(route('api.v1.piggy_banks.index') . $this->buildParams());
|
||||
$paginator->setPath(route('api.v1.rules.index') . $this->buildParams());
|
||||
|
||||
// present to user.
|
||||
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
||||
|
@@ -95,7 +95,7 @@ class RuleGroupController extends Controller
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
// get list of rule groups. Count it and split it.
|
||||
$collection = $this->ruleGroupRepository->get();
|
||||
$count = $collection->count();
|
||||
$ruleGroups = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||
|
Reference in New Issue
Block a user