Expand test code.

This commit is contained in:
James Cole
2017-12-17 18:23:10 +01:00
parent c1e1da12c2
commit c7d4ff6f27
15 changed files with 446 additions and 42 deletions

View File

@@ -183,7 +183,7 @@ class ReconcileController extends Controller
$currencyId = intval($account->getMeta('currency_id'));
$currency = $currencyRepos->find($currencyId);
if (0 === $currencyId) {
$currency = app('amount')->getDefaultCurrency();
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
}
// no start or end:
@@ -233,9 +233,10 @@ class ReconcileController extends Controller
// get main transaction:
$transaction = $repository->getAssetTransaction($journal);
$account = $transaction->account;
return view('accounts.reconcile.show', compact('journal', 'subTitle', 'transaction'));
return view('accounts.reconcile.show', compact('journal', 'subTitle', 'transaction', 'account'));
}
/**
@@ -250,7 +251,7 @@ class ReconcileController extends Controller
{
/** @var JournalRepositoryInterface $repository */
$repository = app(JournalRepositoryInterface::class);
$transactions = $repository->getTransactionsById($request->get('transactions'));
$transactions = $repository->getTransactionsById($request->get('transactions') ?? []);
/** @var Transaction $transaction */
foreach ($transactions as $transaction) {
$repository->reconcile($transaction); // mark as reconciled.
@@ -313,7 +314,7 @@ class ReconcileController extends Controller
$currencyId = intval($account->getMeta('currency_id'));
$currency = $currencyRepos->find($currencyId);
if (0 === $currencyId) {
$currency = app('amount')->getDefaultCurrency();
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
}
$startBalance = round(app('steam')->balance($account, $startDate), $currency->decimal_places);
@@ -383,7 +384,7 @@ class ReconcileController extends Controller
/** @var Transaction $transaction */
$transaction = $account->transactions()->first();
if (null === $transaction) {
throw new FireflyException('Expected a transaction. This account has none. BEEP, error.');
throw new FireflyException(sprintf('Expected a transaction. Account #%d has none. BEEP, error.', $account->id)); // @codeCoverageIgnore
}
$journal = $transaction->transactionJournal;

View File

@@ -32,21 +32,15 @@ use Illuminate\Http\Request;
use Schema;
/**
* @codeCoverageIgnore
* Class LoginController
*
* This controller handles authenticating users for the application and
* redirecting them to your home screen. The controller uses a trait
* to conveniently provide its functionality to your applications.
*/
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**

View File

@@ -32,20 +32,15 @@ use Illuminate\Support\Facades\Validator;
use Session;
/**
* @codeCoverageIgnore
* Class RegisterController
*
* This controller handles the registration of new users as well as their
* validation and creation. By default this controller uses a trait to
* provide this functionality without requiring any additional code.
*/
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;

View File

@@ -26,21 +26,15 @@ use FireflyIII\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
/**
* @codeCoverageIgnore
* Class ResetPasswordController
*
* This controller is responsible for handling password reset requests
* and uses a simple trait to include this behavior. You're free to
* explore this trait and override any methods you wish to tweak.
*/
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**

View File

@@ -303,7 +303,7 @@ class BudgetController extends Controller
++$count;
}
if ($count === 0) {
$count = 1;
$count = 1; // @codeCoverageIgnore
}
$result['available'] = bcdiv($total, strval($count));

View File

@@ -73,7 +73,7 @@ class CategoryController extends Controller
$start = $repository->firstUseDate($category);
if (null === $start) {
$start = new Carbon;
$start = new Carbon; // @codeCoverageIgnore
}
$range = Preferences::get('viewRange', '1M')->data;

View File

@@ -82,7 +82,7 @@ class ExpenseReportController extends Controller
$cache->addProperty($start);
$cache->addProperty($end);
if ($cache->has()) {
// return Response::json($cache->get()); // @codeCoverageIgnore
return Response::json($cache->get()); // @codeCoverageIgnore
}
$format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);

View File

@@ -417,7 +417,7 @@ class RuleController extends Controller
$triggers = $rule->ruleTriggers;
if (0 === count($triggers)) {
return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]);
return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
}
$limit = intval(config('firefly.test-triggers.limit'));

View File

@@ -98,6 +98,23 @@ Breadcrumbs::register(
}
);
Breadcrumbs::register(
'accounts.reconcile',
function (BreadCrumbGenerator $breadcrumbs, Account $account) {
$breadcrumbs->parent('accounts.show', $account, '(nothing)', new Carbon, new Carbon);
$breadcrumbs->push(trans('firefly.reconcile_account', ['account' => e($account->name)]), route('accounts.reconcile', [$account->id]));
}
);
Breadcrumbs::register(
'accounts.reconcile.show',
function (BreadCrumbGenerator $breadcrumbs, Account $account, TransactionJournal $journal) {
$breadcrumbs->parent('accounts.show', $account, '(nothing)', new Carbon, new Carbon);
$title = trans('firefly.reconciliation') . ' "' . $journal->description . '"';
$breadcrumbs->push($title, route('accounts.reconcile.show', [$journal->id]));
}
);
Breadcrumbs::register(
'accounts.delete',
function (BreadCrumbGenerator $breadcrumbs, Account $account) {