Improve test coverage.

This commit is contained in:
James Cole
2019-06-29 08:14:28 +02:00
parent cf904eb677
commit 003d07504f
33 changed files with 447 additions and 269 deletions

View File

@@ -50,6 +50,7 @@ class CategoryController extends Controller
/**
* CategoryController constructor.
* @codeCoverageIgnore
*/
public function __construct()
{
@@ -106,6 +107,7 @@ class CategoryController extends Controller
],
];
$step = $this->calculateStep($start, $end);
/** @var Carbon $current */
$current = clone $start;
Log::debug(sprintf('abc Step is %s', $step));
@@ -124,9 +126,12 @@ class CategoryController extends Controller
$current->addDay();
}
break;
// @codeCoverageIgnoreStart
// for some reason it doesn't pick up on these case entries.
case '1W':
case '1M':
case '1Y':
// @codeCoverageIgnoreEnd
while ($current <= $end) {
$currentEnd = app('navigation')->endOfPeriod($current, $step);
Log::debug(sprintf('abc Range is %s to %s', $current->format('Y-m-d'), $currentEnd->format('Y-m-d')));
@@ -391,7 +396,7 @@ class CategoryController extends Controller
$start = app('navigation')->startOfPeriod($date, $range);
$end = session()->get('end');
if ($end < $start) {
[$end, $start] = [$start, $end];
[$end, $start] = [$start, $end]; // @codeCoverageIgnore
}
$data = $this->makePeriodChart($category, $start, $end);