Fix some pointers in test code [skip ci]

This commit is contained in:
James Cole 2019-08-29 21:32:50 +02:00
parent 19feefda2d
commit 9d8625df3b
6 changed files with 22 additions and 20 deletions

View File

@ -30,7 +30,6 @@ use Illuminate\Support\Collection;
/**
* Interface NetWorthInterface
*
* @package FireflyIII\Helpers\Report
*/
interface NetWorthInterface
{

View File

@ -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'));
}
}

View File

@ -31,7 +31,6 @@ use Illuminate\Support\Collection;
/**
* Interface NoCategoryRepositoryInterface
*
* @package FireflyIII\Repositories\Category
*/
interface NoCategoryRepositoryInterface
{

View File

@ -30,7 +30,6 @@ use Illuminate\Support\Collection;
/**
* Interface OperationsRepositoryInterface
*
* @package FireflyIII\Repositories\Category
*/
interface OperationsRepositoryInterface
{

View File

@ -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
{

View File

@ -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
{