From 9d8625df3be119325efbdb118e7249994cdf68ed Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 29 Aug 2019 21:32:50 +0200 Subject: [PATCH] Fix some pointers in test code [skip ci] --- app/Helpers/Report/NetWorthInterface.php | 1 - .../Controllers/Budget/AmountController.php | 19 ++++++++++++------- .../NoCategoryRepositoryInterface.php | 1 - .../OperationsRepositoryInterface.php | 1 - .../Api/V1/Controllers/RuleControllerTest.php | 8 ++++---- .../Api/V1/Controllers/UserControllerTest.php | 12 ++++++------ 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/app/Helpers/Report/NetWorthInterface.php b/app/Helpers/Report/NetWorthInterface.php index 620274cf4f..b186f8575a 100644 --- a/app/Helpers/Report/NetWorthInterface.php +++ b/app/Helpers/Report/NetWorthInterface.php @@ -30,7 +30,6 @@ use Illuminate\Support\Collection; /** * Interface NetWorthInterface * - * @package FireflyIII\Helpers\Report */ interface NetWorthInterface { diff --git a/app/Http/Controllers/Budget/AmountController.php b/app/Http/Controllers/Budget/AmountController.php index 2f17a2baae..4f9c419157 100644 --- a/app/Http/Controllers/Budget/AmountController.php +++ b/app/Http/Controllers/Budget/AmountController.php @@ -29,6 +29,7 @@ use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\BudgetIncomeRequest; use FireflyIII\Models\Budget; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; +use FireflyIII\Repositories\Budget\OperationsRepositoryInterface; use FireflyIII\Support\Http\Controllers\DateCalculation; use Illuminate\Http\JsonResponse; use Illuminate\Http\RedirectResponse; @@ -41,6 +42,9 @@ use Illuminate\Support\Collection; class AmountController extends Controller { use DateCalculation; + + /** @var OperationsRepositoryInterface */ + private $opsRepository; /** @var BudgetRepositoryInterface The budget repository */ private $repository; @@ -57,7 +61,8 @@ class AmountController extends Controller function ($request, $next) { app('view')->share('title', (string)trans('firefly.budgets')); app('view')->share('mainTitleIcon', 'fa-tasks'); - $this->repository = app(BudgetRepositoryInterface::class); + $this->repository = app(BudgetRepositoryInterface::class); + $this->opsRepository = app(OperationsRepositoryInterface::class); return $next($request); } @@ -69,7 +74,7 @@ class AmountController extends Controller * Set the amount for a single budget in a specific period. * * @param Request $request - * @param Budget $budget + * @param Budget $budget * * @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. // 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); if (bccomp(bcmul('1.3', $average), $current) === -1) { $largeDiff = true; @@ -149,7 +154,7 @@ class AmountController extends Controller public function postUpdateIncome(BudgetIncomeRequest $request): RedirectResponse { /** @var Carbon $start */ - $start = Carbon::createFromFormat('Y-m-d', $request->string('start')); + $start = Carbon::createFromFormat('Y-m-d', $request->string('start')); /** @var Carbon $end */ $end = Carbon::createFromFormat('Y-m-d', $request->string('end')); $defaultCurrency = app('amount')->getDefaultCurrency(); @@ -166,8 +171,8 @@ class AmountController extends Controller * Shows the form to update available budget. * * @param Request $request - * @param Carbon $start - * @param Carbon $end + * @param Carbon $start + * @param Carbon $end * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ @@ -178,6 +183,6 @@ class AmountController extends Controller $available = round($available, $defaultCurrency->decimal_places); $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')); } } diff --git a/app/Repositories/Category/NoCategoryRepositoryInterface.php b/app/Repositories/Category/NoCategoryRepositoryInterface.php index c889285753..3881b263e7 100644 --- a/app/Repositories/Category/NoCategoryRepositoryInterface.php +++ b/app/Repositories/Category/NoCategoryRepositoryInterface.php @@ -31,7 +31,6 @@ use Illuminate\Support\Collection; /** * Interface NoCategoryRepositoryInterface * - * @package FireflyIII\Repositories\Category */ interface NoCategoryRepositoryInterface { diff --git a/app/Repositories/Category/OperationsRepositoryInterface.php b/app/Repositories/Category/OperationsRepositoryInterface.php index 84a082d012..0d11cfa73d 100644 --- a/app/Repositories/Category/OperationsRepositoryInterface.php +++ b/app/Repositories/Category/OperationsRepositoryInterface.php @@ -30,7 +30,6 @@ use Illuminate\Support\Collection; /** * Interface OperationsRepositoryInterface * - * @package FireflyIII\Repositories\Category */ interface OperationsRepositoryInterface { diff --git a/tests/Api/V1/Controllers/RuleControllerTest.php b/tests/Api/V1/Controllers/RuleControllerTest.php index 53471e2f5d..d3e59a7231 100644 --- a/tests/Api/V1/Controllers/RuleControllerTest.php +++ b/tests/Api/V1/Controllers/RuleControllerTest.php @@ -61,7 +61,7 @@ class RuleControllerTest extends TestCase /** * @covers \FireflyIII\Api\V1\Controllers\RuleController - * @covers \FireflyIII\Api\V1\Requests\RuleRequest + * @covers \FireflyIII\Api\V1\Requests\RuleStoreRequest */ public function testStore(): void { @@ -112,7 +112,7 @@ class RuleControllerTest extends TestCase /** * @covers \FireflyIII\Api\V1\Controllers\RuleController - * @covers \FireflyIII\Api\V1\Requests\RuleRequest + * @covers \FireflyIII\Api\V1\Requests\RuleStoreRequest */ public function testStoreNoActions(): void { @@ -157,7 +157,7 @@ class RuleControllerTest extends TestCase /** * @covers \FireflyIII\Api\V1\Controllers\RuleController - * @covers \FireflyIII\Api\V1\Requests\RuleRequest + * @covers \FireflyIII\Api\V1\Requests\RuleStoreRequest */ public function testStoreNoTriggers(): void { @@ -347,7 +347,7 @@ class RuleControllerTest extends TestCase /** * @covers \FireflyIII\Api\V1\Controllers\RuleController - * @covers \FireflyIII\Api\V1\Requests\RuleRequest + * @covers \FireflyIII\Api\V1\Requests\RuleUpdateRequest */ public function testUpdate(): void { diff --git a/tests/Api/V1/Controllers/UserControllerTest.php b/tests/Api/V1/Controllers/UserControllerTest.php index f56f7bff84..086e13aaf1 100644 --- a/tests/Api/V1/Controllers/UserControllerTest.php +++ b/tests/Api/V1/Controllers/UserControllerTest.php @@ -56,7 +56,7 @@ class UserControllerTest extends TestCase * Store new user. * * @covers \FireflyIII\Api\V1\Controllers\UserController - * @covers \FireflyIII\Api\V1\Requests\UserRequest + * @covers \FireflyIII\Api\V1\Requests\UserStoreRequest */ public function testStoreBasic(): void { @@ -86,7 +86,7 @@ class UserControllerTest extends TestCase * Store new user using JSON. * * @covers \FireflyIII\Api\V1\Controllers\UserController - * @covers \FireflyIII\Api\V1\Requests\UserRequest + * @covers \FireflyIII\Api\V1\Requests\UserStoreRequest */ public function testStoreBasicJson(): void { @@ -118,7 +118,7 @@ class UserControllerTest extends TestCase * Store user with info already used. * * @covers \FireflyIII\Api\V1\Controllers\UserController - * @covers \FireflyIII\Api\V1\Requests\UserRequest + * @covers \FireflyIII\Api\V1\Requests\UserStoreRequest */ public function testStoreNotUnique(): void { @@ -149,7 +149,7 @@ class UserControllerTest extends TestCase * Store user with info already used. * * @covers \FireflyIII\Api\V1\Controllers\UserController - * @covers \FireflyIII\Api\V1\Requests\UserRequest + * @covers \FireflyIII\Api\V1\Requests\UserStoreRequest */ public function testStoreNotUniqueJson(): void { @@ -180,7 +180,7 @@ class UserControllerTest extends TestCase * Update user. * * @covers \FireflyIII\Api\V1\Controllers\UserController - * @covers \FireflyIII\Api\V1\Requests\UserRequest + * @covers \FireflyIII\Api\V1\Requests\UserStoreRequest */ public function testUpdate(): void { @@ -215,7 +215,7 @@ class UserControllerTest extends TestCase * Update user. * * @covers \FireflyIII\Api\V1\Controllers\UserController - * @covers \FireflyIII\Api\V1\Requests\UserRequest + * @covers \FireflyIII\Api\V1\Requests\UserStoreRequest */ public function testUpdateJson(): void {