Improve test coverage.

This commit is contained in:
James Cole
2017-03-18 20:53:44 +01:00
parent 00b1b54347
commit 1adb0f2f0e
18 changed files with 136 additions and 49 deletions

View File

@@ -370,10 +370,11 @@ class BudgetController extends Controller
Preferences::mark();
if (intval($request->get('create_another')) === 1) {
// set value so create routine will not overwrite URL:
// @codeCoverageIgnoreStart
$request->session()->put('budgets.create.fromStore', true);
return redirect(route('budgets.create'))->withInput();
// @codeCoverageIgnoreEnd
}
return redirect($this->getPreviousUri('budgets.create.uri'));
@@ -394,10 +395,11 @@ class BudgetController extends Controller
Preferences::mark();
if (intval($request->get('return_to_edit')) === 1) {
// set value so edit routine will not overwrite URL:
// @codeCoverageIgnoreStart
$request->session()->put('budgets.edit.fromUpdate', true);
return redirect(route('budgets.edit', [$budget->id]))->withInput(['return_to_edit' => 1]);
// @codeCoverageIgnoreEnd
}
return redirect($this->getPreviousUri('budgets.edit.uri'));

View File

@@ -265,8 +265,8 @@ class CategoryController extends Controller
$end = Navigation::endOfPeriod($start, $range);
$subTitle = trans(
'firefly.journals_in_period_for_category',
['name' => $category->name,
'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
['name' => $category->name,
'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
$periods = $this->getPeriodOverview($category);
}
@@ -278,7 +278,8 @@ class CategoryController extends Controller
$periods = $this->getPeriodOverview($category);
$subTitle = trans(
'firefly.journals_in_period_for_category',
['name' => $category->name,'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
['name' => $category->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
// grab journals, but be prepared to jump a period back to get the right ones:
@@ -304,7 +305,8 @@ class CategoryController extends Controller
if ($moment != 'all' && $loop > 1) {
$subTitle = trans(
'firefly.journals_in_period_for_category',
['name' => $category->name,'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
['name' => $category->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
@@ -327,9 +329,11 @@ class CategoryController extends Controller
Preferences::mark();
if (intval($request->get('create_another')) === 1) {
// @codeCoverageIgnoreStart
$request->session()->put('categories.create.fromStore', true);
return redirect(route('categories.create'))->withInput();
// @codeCoverageIgnoreEnd
}
return redirect(route('categories.index'));
@@ -352,9 +356,11 @@ class CategoryController extends Controller
Preferences::mark();
if (intval($request->get('return_to_edit')) === 1) {
// @codeCoverageIgnoreStart
$request->session()->put('categories.edit.fromUpdate', true);
return redirect(route('categories.edit', [$category->id]));
// @codeCoverageIgnoreEnd
}
return redirect($this->getPreviousUri('categories.edit.uri'));

View File

@@ -120,9 +120,11 @@ class Controller extends BaseController
}
}
// @codeCoverageIgnoreStart
Session::flash('error', strval(trans('firefly.cannot_redirect_to_account')));
return redirect(route('index'));
// @codeCoverageIgnoreEnd
}
/**

View File

@@ -291,7 +291,7 @@ class TagController extends Controller
Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));
}
}
if ($moment != 'all' && $loop > 1) {
$subTitle = trans(
'firefly.journals_in_period_for_tag',