mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 14:41:20 +00:00
New tests.
This commit is contained in:
@@ -24,6 +24,7 @@ use Illuminate\Support\Collection;
|
||||
use Input;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Response;
|
||||
use Session;
|
||||
use Steam;
|
||||
use URL;
|
||||
@@ -243,6 +244,8 @@ class PiggyBankController extends Controller
|
||||
|
||||
/**
|
||||
* @param PiggyBankRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function order(PiggyBankRepositoryInterface $repository)
|
||||
{
|
||||
@@ -257,6 +260,7 @@ class PiggyBankController extends Controller
|
||||
$repository->setOrder(intval($id), ($order + 1));
|
||||
}
|
||||
}
|
||||
return Response::json(['result' => 'ok']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -150,7 +150,7 @@ class PreferencesController extends Controller
|
||||
|
||||
// custom fiscal year
|
||||
$customFiscalYear = intval($request->get('customFiscalYear')) === 1;
|
||||
$fiscalYearStart = date('m-d', strtotime($request->get('fiscalYearStart')));
|
||||
$fiscalYearStart = date('m-d', strtotime(strval($request->get('fiscalYearStart'))));
|
||||
Preferences::set('customFiscalYear', $customFiscalYear);
|
||||
Preferences::set('fiscalYearStart', $fiscalYearStart);
|
||||
|
||||
|
||||
@@ -83,11 +83,12 @@ class ProfileController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ProfileFormRequest $request
|
||||
* @param ProfileFormRequest $request
|
||||
* @param UserRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function postChangePassword(ProfileFormRequest $request)
|
||||
public function postChangePassword(ProfileFormRequest $request, UserRepositoryInterface $repository)
|
||||
{
|
||||
// old, new1, new2
|
||||
if (!Hash::check($request->get('current_password'), auth()->user()->password)) {
|
||||
@@ -103,9 +104,7 @@ class ProfileController extends Controller
|
||||
}
|
||||
|
||||
// update the user with the new password.
|
||||
auth()->user()->password = bcrypt($request->get('new_password'));
|
||||
auth()->user()->save();
|
||||
|
||||
$repository->changePassword(auth()->user(), $request->get('new_password'));
|
||||
Session::flash('success', strval(trans('firefly.password_changed')));
|
||||
|
||||
return redirect(route('profile.index'));
|
||||
|
||||
@@ -42,8 +42,8 @@ class PiggyBankFormRequest extends Request
|
||||
'startdate' => new Carbon,
|
||||
'account_id' => intval($this->get('account_id')),
|
||||
'targetamount' => round($this->get('targetamount'), 2),
|
||||
'targetdate' => strlen($this->get('targetdate')) > 0 ? new Carbon($this->get('targetdate')) : null,
|
||||
'note' => trim($this->get('note')),
|
||||
'targetdate' => strlen(strval($this->get('targetdate'))) > 0 ? new Carbon($this->get('targetdate')) : null,
|
||||
'note' => trim(strval($this->get('note'))),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class PiggyBankFormRequest extends Request
|
||||
'name' => $nameRule,
|
||||
'account_id' => 'required|belongsToUser:accounts',
|
||||
'targetamount' => 'required|min:0.01',
|
||||
'amount_currency_id_targetamount' => 'exists:transaction_currencies,id',
|
||||
'amount_currency_id_targetamount' => 'required|exists:transaction_currencies,id',
|
||||
'startdate' => 'date',
|
||||
'targetdate' => $targetDateRule,
|
||||
'order' => 'integer|min:1',
|
||||
|
||||
@@ -413,7 +413,22 @@ Breadcrumbs::register(
|
||||
'piggy-banks.show', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggy-banks.index');
|
||||
$breadcrumbs->push(e($piggyBank->name), route('piggy-banks.show', [$piggyBank->id]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'piggy-banks.add-money-mobile', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggy-banks.show', $piggyBank);
|
||||
$breadcrumbs->push(trans('firefly.add_money_to_piggy', ['name' => $piggyBank->name]), route('piggy-banks.add-money-mobile', [$piggyBank->id]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'piggy-banks.remove-money-mobile', function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggy-banks.show', $piggyBank);
|
||||
$breadcrumbs->push(
|
||||
trans('firefly.remove_money_from_piggy_title', ['name' => $piggyBank->name]), route('piggy-banks.remove-money-mobile', [$piggyBank->id])
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -513,6 +528,16 @@ Breadcrumbs::register(
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* New user Controller
|
||||
*/
|
||||
Breadcrumbs::register(
|
||||
'new-user.index', function (BreadCrumbGenerator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('firefly.getting_started'), route('new-user.index'));
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Rules
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user