Improve test coverage and fix test code.

This commit is contained in:
James Cole
2018-08-23 18:33:39 +02:00
parent 3f493aceb2
commit d4096103cb
21 changed files with 1378 additions and 21 deletions

View File

@@ -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.
*

View File

@@ -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.');
}

View File

@@ -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));

View File

@@ -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);