mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 18:01:26 -06:00
Fix some pointers in test code [skip ci]
This commit is contained in:
parent
19feefda2d
commit
9d8625df3b
@ -30,7 +30,6 @@ use Illuminate\Support\Collection;
|
|||||||
/**
|
/**
|
||||||
* Interface NetWorthInterface
|
* Interface NetWorthInterface
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Helpers\Report
|
|
||||||
*/
|
*/
|
||||||
interface NetWorthInterface
|
interface NetWorthInterface
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,7 @@ use FireflyIII\Http\Controllers\Controller;
|
|||||||
use FireflyIII\Http\Requests\BudgetIncomeRequest;
|
use FireflyIII\Http\Requests\BudgetIncomeRequest;
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
|
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
|
||||||
use FireflyIII\Support\Http\Controllers\DateCalculation;
|
use FireflyIII\Support\Http\Controllers\DateCalculation;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
@ -41,6 +42,9 @@ use Illuminate\Support\Collection;
|
|||||||
class AmountController extends Controller
|
class AmountController extends Controller
|
||||||
{
|
{
|
||||||
use DateCalculation;
|
use DateCalculation;
|
||||||
|
|
||||||
|
/** @var OperationsRepositoryInterface */
|
||||||
|
private $opsRepository;
|
||||||
/** @var BudgetRepositoryInterface The budget repository */
|
/** @var BudgetRepositoryInterface The budget repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
@ -57,7 +61,8 @@ class AmountController extends Controller
|
|||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
app('view')->share('title', (string)trans('firefly.budgets'));
|
app('view')->share('title', (string)trans('firefly.budgets'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-tasks');
|
app('view')->share('mainTitleIcon', 'fa-tasks');
|
||||||
$this->repository = app(BudgetRepositoryInterface::class);
|
$this->repository = app(BudgetRepositoryInterface::class);
|
||||||
|
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
@ -69,7 +74,7 @@ class AmountController extends Controller
|
|||||||
* Set the amount for a single budget in a specific period.
|
* Set the amount for a single budget in a specific period.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@ -109,7 +114,7 @@ class AmountController extends Controller
|
|||||||
|
|
||||||
// Get the average amount of money the user budgets for this budget. And calculate the same for the current amount.
|
// Get the average amount of money the user budgets for this budget. And calculate the same for the current amount.
|
||||||
// If the difference is very large, give the user a notification.
|
// If the difference is very large, give the user a notification.
|
||||||
$average = $this->repository->budgetedPerDay($budget);
|
$average = $this->opsRepository->budgetedPerDay($budget);
|
||||||
$current = bcdiv($amount, (string)$periodLength);
|
$current = bcdiv($amount, (string)$periodLength);
|
||||||
if (bccomp(bcmul('1.3', $average), $current) === -1) {
|
if (bccomp(bcmul('1.3', $average), $current) === -1) {
|
||||||
$largeDiff = true;
|
$largeDiff = true;
|
||||||
@ -149,7 +154,7 @@ class AmountController extends Controller
|
|||||||
public function postUpdateIncome(BudgetIncomeRequest $request): RedirectResponse
|
public function postUpdateIncome(BudgetIncomeRequest $request): RedirectResponse
|
||||||
{
|
{
|
||||||
/** @var Carbon $start */
|
/** @var Carbon $start */
|
||||||
$start = Carbon::createFromFormat('Y-m-d', $request->string('start'));
|
$start = Carbon::createFromFormat('Y-m-d', $request->string('start'));
|
||||||
/** @var Carbon $end */
|
/** @var Carbon $end */
|
||||||
$end = Carbon::createFromFormat('Y-m-d', $request->string('end'));
|
$end = Carbon::createFromFormat('Y-m-d', $request->string('end'));
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||||
@ -166,8 +171,8 @@ class AmountController extends Controller
|
|||||||
* Shows the form to update available budget.
|
* Shows the form to update available budget.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
@ -178,6 +183,6 @@ class AmountController extends Controller
|
|||||||
$available = round($available, $defaultCurrency->decimal_places);
|
$available = round($available, $defaultCurrency->decimal_places);
|
||||||
$page = (int)$request->get('page');
|
$page = (int)$request->get('page');
|
||||||
|
|
||||||
return view('budgets.income', compact('available', 'start', 'end', 'page','defaultCurrency'));
|
return view('budgets.income', compact('available', 'start', 'end', 'page', 'defaultCurrency'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ use Illuminate\Support\Collection;
|
|||||||
/**
|
/**
|
||||||
* Interface NoCategoryRepositoryInterface
|
* Interface NoCategoryRepositoryInterface
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Repositories\Category
|
|
||||||
*/
|
*/
|
||||||
interface NoCategoryRepositoryInterface
|
interface NoCategoryRepositoryInterface
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,6 @@ use Illuminate\Support\Collection;
|
|||||||
/**
|
/**
|
||||||
* Interface OperationsRepositoryInterface
|
* Interface OperationsRepositoryInterface
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Repositories\Category
|
|
||||||
*/
|
*/
|
||||||
interface OperationsRepositoryInterface
|
interface OperationsRepositoryInterface
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ class RuleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\RuleController
|
* @covers \FireflyIII\Api\V1\Controllers\RuleController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\RuleRequest
|
* @covers \FireflyIII\Api\V1\Requests\RuleStoreRequest
|
||||||
*/
|
*/
|
||||||
public function testStore(): void
|
public function testStore(): void
|
||||||
{
|
{
|
||||||
@ -112,7 +112,7 @@ class RuleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\RuleController
|
* @covers \FireflyIII\Api\V1\Controllers\RuleController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\RuleRequest
|
* @covers \FireflyIII\Api\V1\Requests\RuleStoreRequest
|
||||||
*/
|
*/
|
||||||
public function testStoreNoActions(): void
|
public function testStoreNoActions(): void
|
||||||
{
|
{
|
||||||
@ -157,7 +157,7 @@ class RuleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\RuleController
|
* @covers \FireflyIII\Api\V1\Controllers\RuleController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\RuleRequest
|
* @covers \FireflyIII\Api\V1\Requests\RuleStoreRequest
|
||||||
*/
|
*/
|
||||||
public function testStoreNoTriggers(): void
|
public function testStoreNoTriggers(): void
|
||||||
{
|
{
|
||||||
@ -347,7 +347,7 @@ class RuleControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\RuleController
|
* @covers \FireflyIII\Api\V1\Controllers\RuleController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\RuleRequest
|
* @covers \FireflyIII\Api\V1\Requests\RuleUpdateRequest
|
||||||
*/
|
*/
|
||||||
public function testUpdate(): void
|
public function testUpdate(): void
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ class UserControllerTest extends TestCase
|
|||||||
* Store new user.
|
* Store new user.
|
||||||
*
|
*
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\UserRequest
|
* @covers \FireflyIII\Api\V1\Requests\UserStoreRequest
|
||||||
*/
|
*/
|
||||||
public function testStoreBasic(): void
|
public function testStoreBasic(): void
|
||||||
{
|
{
|
||||||
@ -86,7 +86,7 @@ class UserControllerTest extends TestCase
|
|||||||
* Store new user using JSON.
|
* Store new user using JSON.
|
||||||
*
|
*
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\UserRequest
|
* @covers \FireflyIII\Api\V1\Requests\UserStoreRequest
|
||||||
*/
|
*/
|
||||||
public function testStoreBasicJson(): void
|
public function testStoreBasicJson(): void
|
||||||
{
|
{
|
||||||
@ -118,7 +118,7 @@ class UserControllerTest extends TestCase
|
|||||||
* Store user with info already used.
|
* Store user with info already used.
|
||||||
*
|
*
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\UserRequest
|
* @covers \FireflyIII\Api\V1\Requests\UserStoreRequest
|
||||||
*/
|
*/
|
||||||
public function testStoreNotUnique(): void
|
public function testStoreNotUnique(): void
|
||||||
{
|
{
|
||||||
@ -149,7 +149,7 @@ class UserControllerTest extends TestCase
|
|||||||
* Store user with info already used.
|
* Store user with info already used.
|
||||||
*
|
*
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\UserRequest
|
* @covers \FireflyIII\Api\V1\Requests\UserStoreRequest
|
||||||
*/
|
*/
|
||||||
public function testStoreNotUniqueJson(): void
|
public function testStoreNotUniqueJson(): void
|
||||||
{
|
{
|
||||||
@ -180,7 +180,7 @@ class UserControllerTest extends TestCase
|
|||||||
* Update user.
|
* Update user.
|
||||||
*
|
*
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\UserRequest
|
* @covers \FireflyIII\Api\V1\Requests\UserStoreRequest
|
||||||
*/
|
*/
|
||||||
public function testUpdate(): void
|
public function testUpdate(): void
|
||||||
{
|
{
|
||||||
@ -215,7 +215,7 @@ class UserControllerTest extends TestCase
|
|||||||
* Update user.
|
* Update user.
|
||||||
*
|
*
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
* @covers \FireflyIII\Api\V1\Controllers\UserController
|
||||||
* @covers \FireflyIII\Api\V1\Requests\UserRequest
|
* @covers \FireflyIII\Api\V1\Requests\UserStoreRequest
|
||||||
*/
|
*/
|
||||||
public function testUpdateJson(): void
|
public function testUpdateJson(): void
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user