mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 15:39:50 +00:00
Expanded test coverage.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Admin;
|
||||
|
||||
@@ -18,6 +18,7 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Requests\UserFormRequest;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Session;
|
||||
use View;
|
||||
@@ -129,29 +130,27 @@ class UserController extends Controller
|
||||
*
|
||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function update(UserFormRequest $request, User $user)
|
||||
public function update(UserFormRequest $request, User $user, UserRepositoryInterface $repository)
|
||||
{
|
||||
Log::debug('Actually here');
|
||||
$data = $request->getUserData();
|
||||
|
||||
// update password
|
||||
if (strlen($data['password']) > 0) {
|
||||
$user->password = bcrypt($data['password']);
|
||||
$user->save();
|
||||
$repository->changePassword($user, $data['password']);
|
||||
}
|
||||
|
||||
// change blocked status and code:
|
||||
$user->blocked = $data['blocked'];
|
||||
$user->blocked_code = $data['blocked_code'];
|
||||
$user->save();
|
||||
$repository->changeStatus($user, $data['blocked'], $data['blocked_code']);
|
||||
|
||||
Session::flash('success', strval(trans('firefly.updated_user', ['email' => $user->email])));
|
||||
Preferences::mark();
|
||||
|
||||
if (intval($request->get('return_to_edit')) === 1) {
|
||||
// set value so edit routine will not overwrite URL:
|
||||
// @codeCoverageIgnoreStart
|
||||
Session::put('users.edit.fromUpdate', true);
|
||||
|
||||
return redirect(route('admin.users.edit', [$user->id]))->withInput(['return_to_edit' => 1]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
// redirect to previous URL.
|
||||
|
||||
@@ -19,6 +19,8 @@ use Illuminate\Http\Request;
|
||||
use Password;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class ForgotPasswordController
|
||||
*
|
||||
* @package FireflyIII\Http\Controllers\Auth
|
||||
|
||||
@@ -22,6 +22,8 @@ use Illuminate\Http\Request;
|
||||
use Lang;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class LoginController
|
||||
*
|
||||
* @package FireflyIII\Http\Controllers\Auth
|
||||
|
||||
@@ -22,6 +22,8 @@ use Illuminate\Support\Facades\Password;
|
||||
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class PasswordController
|
||||
*
|
||||
* @package FireflyIII\Http\Controllers\Auth
|
||||
|
||||
@@ -24,6 +24,8 @@ use Session;
|
||||
use Validator;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class RegisterController
|
||||
*
|
||||
* @package FireflyIII\Http\Controllers\Auth
|
||||
|
||||
@@ -16,6 +16,8 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class ResetPasswordController
|
||||
*
|
||||
* @package FireflyIII\Http\Controllers\Auth
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
@@ -144,7 +144,7 @@ class TagController extends Controller
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function edit(Tag $tag)
|
||||
public function edit(Tag $tag, TagRepositoryInterface $repository)
|
||||
{
|
||||
$subTitle = trans('firefly.edit_tag', ['tag' => $tag->tag]);
|
||||
$subTitleIcon = 'fa-tag';
|
||||
@@ -158,8 +158,8 @@ class TagController extends Controller
|
||||
/*
|
||||
* Can this tag become another type?
|
||||
*/
|
||||
$allowAdvance = $tag->tagAllowAdvance();
|
||||
$allowToBalancingAct = $tag->tagAllowBalancing();
|
||||
$allowAdvance = $repository->tagAllowAdvance($tag);
|
||||
$allowToBalancingAct = $repository->tagAllowBalancing($tag);
|
||||
|
||||
// edit tag options:
|
||||
if ($allowAdvance === false) {
|
||||
@@ -318,10 +318,11 @@ class TagController extends Controller
|
||||
Preferences::mark();
|
||||
|
||||
if (intval($request->get('create_another')) === 1) {
|
||||
// set value so create routine will not overwrite URL:
|
||||
// @codeCoverageIgnoreStart
|
||||
Session::put('tags.create.fromStore', true);
|
||||
|
||||
return redirect(route('tags.create'))->withInput();
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
return redirect($this->getPreviousUri('tags.create.uri'));
|
||||
@@ -343,10 +344,11 @@ class TagController extends Controller
|
||||
Preferences::mark();
|
||||
|
||||
if (intval($request->get('return_to_edit')) === 1) {
|
||||
// set value so edit routine will not overwrite URL:
|
||||
// @codeCoverageIgnoreStart
|
||||
Session::put('tags.edit.fromUpdate', true);
|
||||
|
||||
return redirect(route('tags.edit', [$tag->id]))->withInput(['return_to_edit' => 1]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
// redirect to previous URL.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
@@ -151,10 +151,9 @@ class TransactionController extends Controller
|
||||
$ids = array_unique($ids);
|
||||
foreach ($ids as $id) {
|
||||
$journal = $repository->find(intval($id));
|
||||
if ($journal && $journal->date->format('Y-m-d') == $date->format('Y-m-d')) {
|
||||
$journal->order = $order;
|
||||
if ($journal && $journal->date->isSameDay($date)) {
|
||||
$repository->setOrder($journal, $order);
|
||||
$order++;
|
||||
$journal->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,8 +239,6 @@ class TransactionController extends Controller
|
||||
];
|
||||
Log::debug(sprintf('What is %s', $what));
|
||||
switch ($what) {
|
||||
default:
|
||||
throw new FireflyException(sprintf('Cannot handle "%s"', $what));
|
||||
case 'withdrawal':
|
||||
$array['spent'] = $sum;
|
||||
break;
|
||||
@@ -250,7 +247,6 @@ class TransactionController extends Controller
|
||||
break;
|
||||
case 'transfers':
|
||||
case 'transfer':
|
||||
Log::debug('HERE');
|
||||
$array['transferred'] = Steam::positive($sum);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user