Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix tests.
James Coledb149ca6e121
diff --git a/app/Api/V1/Controllers/TransactionController.php b/app/Api/V1/Controllers/TransactionController.phpindex b877ab0c17..a03b594f42 100644--- a/app/Api/V1/Controllers/TransactionController.php+++ b/app/Api/V1/Controllers/TransactionController.php@@ -139,7 +139,7 @@ class TransactionController extends Controller** @return \Illuminate\Http\JsonResponse*/- public function show(Request $request, Transaction $transaction, string $include)+ public function show(Request $request, Transaction $transaction, string $include = null){$manager = new Manager();$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.phpindex 7e9e9e6ad6..bb7bdc2550 100644--- a/app/Factory/TransactionFactory.php+++ b/app/Factory/TransactionFactory.php@@ -109,7 +109,10 @@ class TransactionFactoryLog::debug(sprintf('Source type is "%s", destination type is "%s"', $sourceAccount->accountType->type, $destinationAccount->accountType->type));// throw big fat error when source type === dest type- if ($sourceAccount->accountType->type === $destinationAccount->accountType->type && $journal->transactionType->type !== TransactionType::TRANSFER) {+ if ($sourceAccount->accountType->type === $destinationAccount->accountType->type+ && ($journal->transactionType->type !== TransactionType::TRANSFER+ && $journal->transactionType->type !== TransactionType::RECONCILIATION)+ ) {throw new FireflyException(sprintf('Source and destination account cannot be both of the type "%s"', $destinationAccount->accountType->type));}if ($sourceAccount->accountType->type !== AccountType::ASSET && $destinationAccount->accountType->type !== AccountType::ASSET) {diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.phpindex 30c5657d59..d2129761e4 100644--- a/app/Http/Controllers/Chart/ReportController.php+++ b/app/Http/Controllers/Chart/ReportController.php@@ -27,6 +27,7 @@ use FireflyIII\Generator\Chart\Basic\GeneratorInterface;use FireflyIII\Http\Controllers\Controller;use FireflyIII\Repositories\Account\AccountTaskerInterface;use FireflyIII\Support\CacheProperties;+use Illuminate\Http\JsonResponse;use Illuminate\Support\Collection;use Log;use Steam;@@ -57,9 +58,9 @@ class ReportController extends Controller* @param Carbon $start* @param Carbon $end*- * @return \Illuminate\Http\JsonResponse+ * @return JsonResponse*/- public function netWorth(Collection $accounts, Carbon $start, Carbon $end)+ public function netWorth(Collection $accounts, Carbon $start, Carbon $end): JsonResponse{// chart properties for cache:$cache = new CacheProperties;diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.phpindex b6ffe94897..6a4b644244 100644--- a/app/Http/Controllers/Transaction/ConvertController.php+++ b/app/Http/Controllers/Transaction/ConvertController.php@@ -30,6 +30,7 @@ use FireflyIII\Models\TransactionType;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\Journal\JournalRepositoryInterface;use Illuminate\Http\Request;+use Log;use View;/**@@ -70,6 +71,8 @@ class ConvertController extends Controller{// @codeCoverageIgnoreStartif ($this->isOpeningBalance($journal)) {+ Log::debug('This is an opening balance.');+return $this->redirectToAccount($journal);}// @codeCoverageIgnoreEnd@@ -80,6 +83,7 @@ class ConvertController extends Controller// cannot convert to its own type.if ($sourceType->type === $destinationType->type) {+ Log::debug('This is already a transaction of the expected type..');session()->flash('info', trans('firefly.convert_is_already_type_' . $destinationType->type));return redirect(route('transactions.show', [$journal->id]));@@ -87,6 +91,7 @@ class ConvertController extends Controller// cannot convert split.if ($journal->transactions()->count() > 2) {+ Log::info('This journal has more than two transactions.');session()->flash('error', trans('firefly.cannot_convert_split_journal'));return redirect(route('transactions.show', [$journal->id]));@@ -118,6 +123,7 @@ class ConvertController extends Controller{// @codeCoverageIgnoreStartif ($this->isOpeningBalance($journal)) {+ Log::debug('Journal is opening balance, return to account.');return $this->redirectToAccount($journal);}// @codeCoverageIgnoreEnd@@ -125,12 +131,14 @@ class ConvertController extends Controller$data = $request->all();if ($journal->transactionType->type === $destinationType->type) {+ Log::info('Journal is already of the desired type.');session()->flash('error', trans('firefly.convert_is_already_type_' . $destinationType->type));return redirect(route('transactions.show', [$journal->id]));}if ($journal->transactions()->count() > 2) {+ Log::info('Journal has more than two transactions.');session()->flash('error', trans('firefly.cannot_convert_split_journal'));return redirect(route('transactions.show', [$journal->id]));diff --git a/app/Models/RecurrenceRepetition.php b/app/Models/RecurrenceRepetition.phpindex 6164e38b99..015a777a0e 100644--- a/app/Models/RecurrenceRepetition.php+++ b/app/Models/RecurrenceRepetition.php@@ -60,6 +60,7 @@ class RecurrenceRepetition extends Model'repetition_type' => 'string','repetition_moment' => 'string','repetition_skip' => 'int',+ 'weekend' => 'int',];protected $fillable = ['recurrence_id', 'weekend', 'repetition_type', 'repetition_moment', 'repetition_skip'];/** @var string */diff --git a/app/Models/Transaction.php b/app/Models/Transaction.phpindex d008f373e9..e14402137f 100644--- a/app/Models/Transaction.php+++ b/app/Models/Transaction.php@@ -74,6 +74,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @property int $attachmentCount* @property int $transaction_currency_id* @property int $foreign_currency_id+ * @property string $amount+ * @property string $foreign_amount+ * @property TransactionJournal $transactionJournal*/class Transaction extends Model{diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.phpindex 7ec25a1266..30f49cdf85 100644--- a/app/Models/TransactionJournal.php+++ b/app/Models/TransactionJournal.php@@ -44,6 +44,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @property int $bill_id* @property Collection $categories* @property bool $completed+ * @property string $description*/class TransactionJournal extends Model{diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.phpindex b4d1ae1e91..02be2641fc 100644--- a/app/Repositories/Recurring/RecurringRepository.php+++ b/app/Repositories/Recurring/RecurringRepository.php@@ -545,7 +545,7 @@ class RecurringRepository implements RecurringRepositoryInterface*/protected function filterWeekends(RecurrenceRepetition $repetition, array $dates): array{- if ($repetition->weekend === RecurrenceRepetition::WEEKEND_DO_NOTHING) {+ if ((int)$repetition->weekend === RecurrenceRepetition::WEEKEND_DO_NOTHING) {Log::debug('Repetition will not be filtered on weekend days.');return $dates;diff --git a/app/Support/Import/Routine/File/CurrencyMapper.php b/app/Support/Import/Routine/File/CurrencyMapper.phpindex 506e2291c8..b2a45500f3 100644--- a/app/Support/Import/Routine/File/CurrencyMapper.php+++ b/app/Support/Import/Routine/File/CurrencyMapper.php@@ -71,7 +71,7 @@ class CurrencyMapperreturn $result;}}- if (null === $data['code']) {+ if (!isset($data['code']) || $data['code'] === null) {return null;}diff --git a/app/Support/Import/Routine/File/ImportableConverter.php b/app/Support/Import/Routine/File/ImportableConverter.phpindex f4a6870501..16e8f5b1d8 100644--- a/app/Support/Import/Routine/File/ImportableConverter.php+++ b/app/Support/Import/Routine/File/ImportableConverter.php@@ -282,7 +282,7 @@ class ImportableConverter'piggy_bank_id' => null,'piggy_bank_name' => null,'bill_id' => $billId,- 'bill_name' => null === $billId ? $importable->billName : null,+ 'bill_name' => $importable->billName,// transaction data:'transactions' => [diff --git a/tests/Api/V1/Controllers/AboutControllerTest.php b/tests/Api/V1/Controllers/AboutControllerTest.phpindex d3ffcb88e0..38094b4c0e 100644--- a/tests/Api/V1/Controllers/AboutControllerTest.php+++ b/tests/Api/V1/Controllers/AboutControllerTest.php@@ -45,8 +45,7 @@ class AboutControllerTest extends TestCase/*** Test the about endpoint*- * @covers \FireflyIII\Api\V1\Controllers\AboutController::__construct- * @covers \FireflyIII\Api\V1\Controllers\AboutController::about+ * @covers \FireflyIII\Api\V1\Controllers\AboutController*/public function testAbout(): void{@@ -65,7 +64,7 @@ class AboutControllerTest extends TestCase/*** Test user end point*- * @covers \FireflyIII\Api\V1\Controllers\AboutController::user+ * @covers \FireflyIII\Api\V1\Controllers\AboutController*/public function testUser(): void{diff --git a/tests/Api/V1/Controllers/AccountControllerTest.php b/tests/Api/V1/Controllers/AccountControllerTest.phpindex 77586a0008..4889d1523f 100644--- a/tests/Api/V1/Controllers/AccountControllerTest.php+++ b/tests/Api/V1/Controllers/AccountControllerTest.php@@ -50,7 +50,7 @@ class AccountControllerTest extends TestCase/*** Destroy account over API.*- * @covers \FireflyIII\Api\V1\Controllers\AccountController::delete+ * @covers \FireflyIII\Api\V1\Controllers\AccountController*/public function testDelete(): void{@@ -72,9 +72,9 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\AccountController::__construct- * @covers \FireflyIII\Api\V1\Controllers\AccountController::index- * @covers \FireflyIII\Api\V1\Controllers\AccountController::mapTypes+ * Test the list of accounts.+ *+ * @covers \FireflyIII\Api\V1\Controllers\AccountController*/public function testIndex(): void{@@ -110,10 +110,8 @@ class AccountControllerTest extends TestCase/*** Opening balance without date.*- * @covers \FireflyIII\Api\V1\Controllers\AccountController::store- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::authorize- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll+ * @covers \FireflyIII\Api\V1\Controllers\AccountController+ * @covers \FireflyIII\Api\V1\Requests\AccountRequest*/public function testInvalidBalance(): void{@@ -152,10 +150,8 @@ class AccountControllerTest extends TestCase/*** CC type present when account is a credit card.*- * @covers \FireflyIII\Api\V1\Controllers\AccountController::store- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::authorize- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll+ * @covers \FireflyIII\Api\V1\Controllers\AccountController+ * @covers \FireflyIII\Api\V1\Requests\AccountRequest*/public function testNoCreditCardData(): void{@@ -194,10 +190,8 @@ class AccountControllerTest extends TestCase/*** No currency information*- * @covers \FireflyIII\Api\V1\Controllers\AccountController::store- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::authorize- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll+ * @covers \FireflyIII\Api\V1\Controllers\AccountController+ * @covers \FireflyIII\Api\V1\Requests\AccountRequest*/public function testNoCurrencyInfo(): void{@@ -233,7 +227,9 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\AccountController::show+ * Show an account.+ *+ * @covers \FireflyIII\Api\V1\Controllers\AccountController:*/public function testShow(): void@@ -268,10 +264,8 @@ class AccountControllerTest extends TestCase/*** Name already in use.*- * @covers \FireflyIII\Api\V1\Controllers\AccountController::store- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::authorize- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll+ * @covers \FireflyIII\Api\V1\Controllers\AccountController+ * @covers \FireflyIII\Api\V1\Requests\AccountRequest*/public function testStoreNotUnique(): void{@@ -300,7 +294,7 @@ class AccountControllerTest extends TestCase['message' => 'The given data was invalid.','errors' => [- 'name' => ['This account name is already in use'],+ 'name' => ['This account name is already in use.'],],]);@@ -310,10 +304,8 @@ class AccountControllerTest extends TestCase/*** Send correct data. Should call account repository store method.*- * @covers \FireflyIII\Api\V1\Controllers\AccountController::store- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::authorize- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll+ * @covers \FireflyIII\Api\V1\Controllers\AccountController+ * @covers \FireflyIII\Api\V1\Requests\AccountRequest*/public function testStoreValid(): void{@@ -354,10 +346,8 @@ class AccountControllerTest extends TestCase/*** Send correct data. Should call account repository store method.*- * @covers \FireflyIII\Api\V1\Controllers\AccountController::store- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::authorize- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll+ * @covers \FireflyIII\Api\V1\Controllers\AccountController+ * @covers \FireflyIII\Api\V1\Requests\AccountRequest*/public function testStoreWithCurrencyCode(): void{@@ -402,8 +392,8 @@ class AccountControllerTest extends TestCase/*** Update first asset account we find. Name can be the same as it was.*- * @covers \FireflyIII\Api\V1\Controllers\AccountController::update- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules+ * @covers \FireflyIII\Api\V1\Controllers\AccountController+ * @covers \FireflyIII\Api\V1\Requests\AccountRequest*/public function testUpdate(): void{@@ -445,8 +435,8 @@ class AccountControllerTest extends TestCase/*** Update first asset account we find. Name can be the same as it was.*- * @covers \FireflyIII\Api\V1\Controllers\AccountController::update- * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules+ * @covers \FireflyIII\Api\V1\Controllers\AccountController+ * @covers \FireflyIII\Api\V1\Requests\AccountRequest*/public function testUpdateCurrencyCode(): void{diff --git a/tests/Api/V1/Controllers/BillControllerTest.php b/tests/Api/V1/Controllers/BillControllerTest.phpindex 76ab361ee3..493b3f1585 100644--- a/tests/Api/V1/Controllers/BillControllerTest.php+++ b/tests/Api/V1/Controllers/BillControllerTest.php@@ -27,6 +27,7 @@ namespace Tests\Api\V1\Controllers;use FireflyIII\Models\Bill;use FireflyIII\Repositories\Bill\BillRepositoryInterface;use Illuminate\Pagination\LengthAwarePaginator;+use Illuminate\Support\Collection;use Laravel\Passport\Passport;use Log;use Tests\TestCase;@@ -70,8 +71,9 @@ class BillControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\BillController::__construct- * @covers \FireflyIII\Api\V1\Controllers\BillController::index+ * Show all bills+ *+ * @covers \FireflyIII\Api\V1\Controllers\BillController*/public function testIndex(): void{@@ -82,8 +84,9 @@ class BillControllerTest extends TestCase$repository = $this->mock(BillRepositoryInterface::class);// mock calls:- $repository->shouldReceive('setUser')->once();+ $repository->shouldReceive('setUser');$repository->shouldReceive('getPaginator')->withAnyArgs()->andReturn($paginator)->once();+ $repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());// test API$response = $this->get('/api/v1/bills');@@ -97,7 +100,9 @@ class BillControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\BillController::show+ * Show one bill+ *+ * @covers \FireflyIII\Api\V1\Controllers\BillController*/public function testShow(): void{@@ -106,8 +111,8 @@ class BillControllerTest extends TestCase$repository = $this->mock(BillRepositoryInterface::class);// mock calls:- $repository->shouldReceive('setUser')->once();-+ $repository->shouldReceive('setUser');+ $repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());// test API$response = $this->get('/api/v1/bills/' . $bill->id);$response->assertStatus(200);@@ -121,11 +126,9 @@ class BillControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\BillController::store- * @covers \FireflyIII\Api\V1\Requests\BillRequest::rules- * @covers \FireflyIII\Api\V1\Requests\BillRequest::authorize- * @covers \FireflyIII\Api\V1\Requests\BillRequest::getAll- * @covers \FireflyIII\Api\V1\Requests\BillRequest::withValidator+ * Store with minimum amount more than maximum amount+ * @covers \FireflyIII\Api\V1\Controllers\BillController+ * @covers \FireflyIII\Api\V1\Requests\BillRequest*/public function testStoreMinOverMax(): void{@@ -167,10 +170,10 @@ class BillControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\BillController::store- * @covers \FireflyIII\Api\V1\Requests\BillRequest::rules- * @covers \FireflyIII\Api\V1\Requests\BillRequest::authorize- * @covers \FireflyIII\Api\V1\Requests\BillRequest::getAll+ * Store a valid bill+ *+ * @covers \FireflyIII\Api\V1\Controllers\BillController+ * @covers \FireflyIII\Api\V1\Requests\BillRequest*/public function testStoreValid(): void{@@ -179,9 +182,9 @@ class BillControllerTest extends TestCase$repository = $this->mock(BillRepositoryInterface::class);// mock calls:- $repository->shouldReceive('setUser')->once();+ $repository->shouldReceive('setUser')->times(2);$repository->shouldReceive('store')->andReturn($bill);-+ $repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());// data to submit:$data = ['name' => 'New bill #' . random_int(1, 1000),@@ -206,10 +209,10 @@ class BillControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\BillController::update- * @covers \FireflyIII\Api\V1\Requests\BillRequest::rules- * @covers \FireflyIII\Api\V1\Requests\BillRequest::authorize- * @covers \FireflyIII\Api\V1\Requests\BillRequest::getAll+ * Update a valid bill.+ *+ * @covers \FireflyIII\Api\V1\Controllers\BillController+ * @covers \FireflyIII\Api\V1\Requests\BillRequest*/public function testUpdateValid(): void{@@ -218,9 +221,9 @@ class BillControllerTest extends TestCase$repository = $this->mock(BillRepositoryInterface::class);// mock calls:- $repository->shouldReceive('setUser')->once();+ $repository->shouldReceive('setUser')->times(2);$repository->shouldReceive('update')->andReturn($bill);-+ $repository->shouldReceive('getRulesForBill')->withAnyArgs()->andReturn(new Collection());// data to submit:$data = ['name' => 'New bill #' . random_int(1, 1000),diff --git a/tests/Api/V1/Controllers/CurrencyControllerTest.php b/tests/Api/V1/Controllers/CurrencyControllerTest.phpindex 48c3c47610..d6fb9884b3 100644--- a/tests/Api/V1/Controllers/CurrencyControllerTest.php+++ b/tests/Api/V1/Controllers/CurrencyControllerTest.php@@ -102,7 +102,7 @@ class CurrencyControllerTest extends TestCase'pagination' => ['total' => $collection->count(),'count' => $collection->count(),- 'per_page' => 100,+ 'per_page' => true, // depends on user preference.'current_page' => 1,'total_pages' => 1,],@@ -142,6 +142,8 @@ class CurrencyControllerTest extends TestCase}/**+ * Store new currency.+ ** @covers \FireflyIII\Api\V1\Controllers\CurrencyController* @covers \FireflyIII\Api\V1\Requests\CurrencyRequest*/@@ -173,6 +175,8 @@ class CurrencyControllerTest extends TestCase}/**+ * Store new currency and make it default.+ ** @covers \FireflyIII\Api\V1\Controllers\CurrencyController* @covers \FireflyIII\Api\V1\Requests\CurrencyRequest*/@@ -208,6 +212,8 @@ class CurrencyControllerTest extends TestCase}/**+ * Update currency.+ ** @covers \FireflyIII\Api\V1\Controllers\CurrencyController* @covers \FireflyIII\Api\V1\Requests\CurrencyRequest*/@@ -238,6 +244,8 @@ class CurrencyControllerTest extends TestCase}/**+ * Update currency and make default.+ ** @covers \FireflyIII\Api\V1\Controllers\CurrencyController* @covers \FireflyIII\Api\V1\Requests\CurrencyRequest*/diff --git a/tests/Api/V1/Controllers/TransactionControllerTest.php b/tests/Api/V1/Controllers/TransactionControllerTest.phpindex a17d46a389..e3176207df 100644--- a/tests/Api/V1/Controllers/TransactionControllerTest.php+++ b/tests/Api/V1/Controllers/TransactionControllerTest.php@@ -54,10 +54,9 @@ class TransactionControllerTest extends TestCase}/**- * Destroy account over API.+ * Destroy journal over API.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::__construct- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::delete+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController*/public function testDelete(): void{@@ -80,7 +79,7 @@ class TransactionControllerTest extends TestCase/*** Submit with bad currency code*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailCurrencyCode(): void@@ -127,7 +126,7 @@ class TransactionControllerTest extends TestCase/*** Submit with bad currency ID.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailCurrencyId(): void@@ -173,7 +172,7 @@ class TransactionControllerTest extends TestCase/*** Empty descriptions*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailEmptyDescriptions(): void@@ -225,7 +224,7 @@ class TransactionControllerTest extends TestCase/*** Submit all empty descriptions for transactions.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailEmptySplitDescriptions(): void@@ -282,7 +281,7 @@ class TransactionControllerTest extends TestCase/*** Submitted expense account instead of asset account.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest* @covers \FireflyIII\Rules\BelongsUser*/@@ -331,7 +330,7 @@ class TransactionControllerTest extends TestCase/*** Submitted expense account name instead of asset account name.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailExpenseName(): void@@ -378,7 +377,7 @@ class TransactionControllerTest extends TestCase/*** Submit no asset account info at all.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailNoAsset(): void@@ -422,7 +421,7 @@ class TransactionControllerTest extends TestCase/*** Submit no transactions.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailNoData(): void@@ -459,7 +458,7 @@ class TransactionControllerTest extends TestCase/*** Submit foreign currency without foreign currency info.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailNoForeignCurrencyInfo(): void@@ -507,7 +506,7 @@ class TransactionControllerTest extends TestCase/*** Submit revenue ID instead of expense ID.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailOpposingRevenueID(): void@@ -559,9 +558,9 @@ class TransactionControllerTest extends TestCase/*** Submit journal with a bill ID that is not yours.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest- * @covers \FireflyiII\Rules\BelongsUser+ * @covers \FireflyIII\Rules\BelongsUser*/public function testFailOwnershipBillId(): void{@@ -616,11 +615,11 @@ class TransactionControllerTest extends TestCase}/**- * Submit journal with a bill ID that is not yours.+ * Submit journal with a bill name that is not yours.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest- * @covers \FireflyiII\Rules\BelongsUser+ * @covers \FireflyIII\Rules\BelongsUser*/public function testFailOwnershipBillName(): void{@@ -676,9 +675,9 @@ class TransactionControllerTest extends TestCase/*** Submit journal with a budget ID that is not yours.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest- * @covers \FireflyiII\Rules\BelongsUser+ * @covers \FireflyIII\Rules\BelongsUser*/public function testFailOwnershipBudgetId(): void{@@ -734,9 +733,9 @@ class TransactionControllerTest extends TestCase/*** Submit journal with a budget name that is not yours.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest- * @covers \FireflyiII\Rules\BelongsUser+ * @covers \FireflyIII\Rules\BelongsUser*/public function testFailOwnershipBudgetName(): void{@@ -792,9 +791,9 @@ class TransactionControllerTest extends TestCase/*** Submit journal with a category ID that is not yours.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest- * @covers \FireflyiII\Rules\BelongsUser+ * @covers \FireflyIII\Rules\BelongsUser*/public function testFailOwnershipCategoryId(): void{@@ -850,9 +849,9 @@ class TransactionControllerTest extends TestCase/*** Submit journal with a piggy bank that is not yours.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest- * @covers \FireflyiII\Rules\BelongsUser+ * @covers \FireflyIII\Rules\BelongsUser*/public function testFailOwnershipPiggyBankID(): void{@@ -916,9 +915,9 @@ class TransactionControllerTest extends TestCase/*** Submit journal with a piggy bank that is not yours.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest- * @covers \FireflyiII\Rules\BelongsUser+ * @covers \FireflyIII\Rules\BelongsUser*/public function testFailOwnershipPiggyBankName(): void{@@ -982,7 +981,7 @@ class TransactionControllerTest extends TestCase/*** Submitted revenue account instead of asset account in deposit.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest* @covers \FireflyIII\Rules\BelongsUser*/@@ -1029,7 +1028,7 @@ class TransactionControllerTest extends TestCase/*** Try to store a withdrawal with different source accounts.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailSplitDeposit(): void@@ -1086,7 +1085,7 @@ class TransactionControllerTest extends TestCase/*** Try to store a withdrawal with different source accounts.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailSplitTransfer(): void@@ -1139,7 +1138,7 @@ class TransactionControllerTest extends TestCase'All accounts in this field must be equal.',],'transactions.1.destination_id' => [- 'The source account equals the destination account',+ 'The source account equals the destination account.',],],]@@ -1150,7 +1149,7 @@ class TransactionControllerTest extends TestCase/*** Try to store a withdrawal with different source accounts.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testFailSplitWithdrawal(): void@@ -1206,11 +1205,7 @@ class TransactionControllerTest extends TestCase/*** Show index.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::__construct- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::index- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::mapTypes- *- * throws \FireflyIII\Exceptions\FireflyException+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController*/public function testIndex(): void{@@ -1261,10 +1256,9 @@ class TransactionControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::__construct- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::index- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::mapTypes- * throws \FireflyIII\Exceptions\FireflyException+ * Show index with range.+ *+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController*/public function testIndexWithRange(): void{@@ -1329,7 +1323,9 @@ class TransactionControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::show+ * Show a deposit.+ *+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController*/public function testShowDeposit(): void{@@ -1390,7 +1386,9 @@ class TransactionControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::show+ * Show a withdrawal.+ *+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController*/public function testShowWithdrawal(): void{@@ -1460,7 +1458,7 @@ class TransactionControllerTest extends TestCase/*** Submit a transaction (withdrawal) with attached bill ID*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessBillId(): void@@ -1501,7 +1499,7 @@ class TransactionControllerTest extends TestCase/*** Submit a transaction (withdrawal) with attached bill ID*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessBillName(): void@@ -1542,7 +1540,7 @@ class TransactionControllerTest extends TestCase/*** Add opposing account by a new name.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessNewStoreOpposingName(): void@@ -1582,7 +1580,7 @@ class TransactionControllerTest extends TestCase/*** Submit the minimum amount of data required to create a withdrawal.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreAccountName(): void@@ -1621,7 +1619,7 @@ class TransactionControllerTest extends TestCase/*** Submit the minimum amount of data required to create a withdrawal.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreBasic(): void@@ -1660,7 +1658,7 @@ class TransactionControllerTest extends TestCase/*** Submit the minimum amount of data required to create a withdrawal.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreBasicByName(): void@@ -1701,7 +1699,7 @@ class TransactionControllerTest extends TestCase/*** Submit the minimum amount of data required to create a deposit.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreBasicDeposit(): void@@ -1740,7 +1738,7 @@ class TransactionControllerTest extends TestCase/*** Submit with existing budget ID, see it reflected in output.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreBudgetId(): void@@ -1779,7 +1777,7 @@ class TransactionControllerTest extends TestCase/*** Submit with existing budget name, see it reflected in output.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreBudgetName(): void@@ -1819,7 +1817,7 @@ class TransactionControllerTest extends TestCase/*** Submit with existing category ID, see it reflected in output.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreCategoryID(): void@@ -1858,7 +1856,7 @@ class TransactionControllerTest extends TestCase/*** Submit with existing category name, see it reflected in output.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreCategoryName(): void@@ -1897,7 +1895,7 @@ class TransactionControllerTest extends TestCase/*** Add foreign amount information.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreForeignAmount(): void@@ -1938,7 +1936,7 @@ class TransactionControllerTest extends TestCase/*** Add all available meta data fields.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreMetaData(): void@@ -1983,7 +1981,7 @@ class TransactionControllerTest extends TestCase/*** Submit with NEW category name, see it reflected in output.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreNewCategoryName(): void@@ -2023,7 +2021,7 @@ class TransactionControllerTest extends TestCase/*** Add opposing account by name.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreNewOpposingName(): void@@ -2063,7 +2061,7 @@ class TransactionControllerTest extends TestCase/*** Submit the minimum amount of data required to create a withdrawal.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreNotes(): void@@ -2102,7 +2100,7 @@ class TransactionControllerTest extends TestCase/*** Add opposing account by ID.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreOpposingID(): void@@ -2141,7 +2139,7 @@ class TransactionControllerTest extends TestCase/*** Add opposing account by name.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreOpposingName(): void@@ -2182,7 +2180,7 @@ class TransactionControllerTest extends TestCase* Submit the minimum amount of data required to create a withdrawal.* When sending a piggy bank by name, this must be reflected in the output.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStorePiggyDeposit(): void@@ -2221,7 +2219,7 @@ class TransactionControllerTest extends TestCase* Submit the minimum amount of data required to create a withdrawal.* When sending a piggy bank by name, this must be reflected in the output.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStorePiggyId(): void@@ -2261,7 +2259,7 @@ class TransactionControllerTest extends TestCase* Submit the minimum amount of data required to create a withdrawal.* When sending a piggy bank by name, this must be reflected in the output.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStorePiggyName(): void@@ -2300,7 +2298,7 @@ class TransactionControllerTest extends TestCase/*** Set a different reconciled var*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreReconciled(): void@@ -2338,7 +2336,7 @@ class TransactionControllerTest extends TestCase/*** Submit the data required for a split withdrawal.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreSplit(): void@@ -2385,7 +2383,7 @@ class TransactionControllerTest extends TestCase* Submit the minimum amount of data required to create a withdrawal.* Add some tags as well. Expect to see them in the result.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testSuccessStoreTags(): void@@ -2429,7 +2427,7 @@ class TransactionControllerTest extends TestCase* Fire enough to trigger an update. Since the create code already fires on the Request, no* need to verify all of that.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::update+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testUpdateBasicDeposit(): void@@ -2470,7 +2468,7 @@ class TransactionControllerTest extends TestCase* Fire enough to trigger an update. Since the create code already fires on the Request, no* need to verify all of that.*- * @covers \FireflyIII\Api\V1\Controllers\TransactionController::update+ * @covers \FireflyIII\Api\V1\Controllers\TransactionController* @covers \FireflyIII\Api\V1\Requests\TransactionRequest*/public function testUpdateBasicWithdrawal(): voiddiff --git a/tests/Api/V1/Controllers/UserControllerTest.php b/tests/Api/V1/Controllers/UserControllerTest.phpindex 7db9ea3925..905532bee4 100644--- a/tests/Api/V1/Controllers/UserControllerTest.php+++ b/tests/Api/V1/Controllers/UserControllerTest.php@@ -50,8 +50,7 @@ class UserControllerTest extends TestCase/*** Delete a user.*- * @covers \FireflyIII\Api\V1\Controllers\UserController::__construct- * @covers \FireflyIII\Api\V1\Controllers\UserController::delete+ * @covers \FireflyIII\Api\V1\Controllers\UserController* @covers \FireflyIII\Api\V1\Requests\UserRequest*/public function testDelete(): void@@ -68,8 +67,7 @@ class UserControllerTest extends TestCase/*** Delete a user as non admin*- * @covers \FireflyIII\Api\V1\Controllers\UserController::__construct- * @covers \FireflyIII\Api\V1\Controllers\UserController::delete+ * @covers \FireflyIII\Api\V1\Controllers\UserController* @covers \FireflyIII\Api\V1\Requests\UserRequest*/public function testDeleteNoAdmin(): void@@ -86,8 +84,9 @@ class UserControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\UserController::__construct- * @covers \FireflyIII\Api\V1\Controllers\UserController::index+ * Show list of users.+ *+ * @covers \FireflyIII\Api\V1\Controllers\UserController*/public function testIndex(): void{@@ -111,7 +110,9 @@ class UserControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\UserController::show+ * Show single user.+ *+ * @covers \FireflyIII\Api\V1\Controllers\UserController*/public function testShow(): void{@@ -124,7 +125,9 @@ class UserControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\UserController::store+ * Store new user.+ *+ * @covers \FireflyIII\Api\V1\Controllers\UserController* @covers \FireflyIII\Api\V1\Requests\UserRequest*/public function testStoreBasic(): void@@ -145,7 +148,9 @@ class UserControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\UserController::store+ * Store user with info already used.+ *+ * @covers \FireflyIII\Api\V1\Controllers\UserController* @covers \FireflyIII\Api\V1\Requests\UserRequest*/public function testStoreNotUnique(): void@@ -174,7 +179,9 @@ class UserControllerTest extends TestCase}/**- * @covers \FireflyIII\Api\V1\Controllers\UserController::update+ * Update user.+ *+ * @covers \FireflyIII\Api\V1\Controllers\UserController:* @covers \FireflyIII\Api\V1\Requests\UserRequest*/public function testUpdate(): voiddiff --git a/tests/Feature/Controllers/Account/ReconcileControllerTest.php b/tests/Feature/Controllers/Account/ReconcileControllerTest.phpindex f549fb9a2e..a3a33e47ab 100644--- a/tests/Feature/Controllers/Account/ReconcileControllerTest.php+++ b/tests/Feature/Controllers/Account/ReconcileControllerTest.php@@ -37,10 +37,6 @@ use Mockery;/*** Class ConfigurationControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class ReconcileControllerTest extends TestCase{@@ -54,7 +50,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::edit+ * Test editing a reconciliation.+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testEdit(): void{@@ -76,7 +74,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::edit+ * Test the redirect if journal is not a reconciliation.+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testEditRedirect(): void{@@ -88,7 +88,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::overview()+ * Test overview of reconciliation.+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testOverview(): void{@@ -109,7 +111,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::overview()+ * Test overview when it's not an asset.+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController* @expectedExceptionMessage is not an asset account*/public function testOverviewNotAsset(): void@@ -127,9 +131,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::__construct- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile()- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount()+ * Test showing the reconciliation.+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testReconcile(): void{@@ -144,9 +148,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::__construct- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile()- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount()+ * Test showing the reconciliation (its a initial balance).+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testReconcileInitialBalance(): void{@@ -158,9 +162,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::__construct- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile()- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount()+ * Test reconcile view (without date info).+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testReconcileNoDates(): void{@@ -176,9 +180,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::__construct- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile()- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount()+ * Test reconcile view (without end date).+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testReconcileNoEndDate(): void{@@ -194,9 +198,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::__construct- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile()- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount()+ * Test reconcile view when account is not an asset.+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testReconcileNotAsset(): void{@@ -207,7 +211,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::show()+ * Test show for actual reconciliation.+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testShow(): void{@@ -225,7 +231,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::show()+ * Test show for actual reconciliation, but its not a reconciliation.+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testShowSomethingElse(): void{@@ -237,7 +245,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::submit()+ * Submit reconciliation.+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController* @covers \FireflyIII\Http\Requests\ReconciliationStoreRequest*/public function testSubmit(): void@@ -266,7 +276,9 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::transactions()+ * List transactions for reconciliation view.+ *+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testTransactions(): void{@@ -279,7 +291,7 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::transactions()+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController*/public function testTransactionsInitialBalance(): void{@@ -291,7 +303,7 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::update+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController* @covers \FireflyIII\Http\Requests\ReconciliationUpdateRequest*/public function testUpdate(): void@@ -314,7 +326,7 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::update+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController* @covers \FireflyIII\Http\Requests\ReconciliationUpdateRequest*/public function testUpdateNotReconcile(): void@@ -331,7 +343,7 @@ class ReconcileControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::update+ * @covers \FireflyIII\Http\Controllers\Account\ReconcileController* @covers \FireflyIII\Http\Requests\ReconciliationUpdateRequest*/public function testUpdateZero(): voiddiff --git a/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php b/tests/Feature/Controllers/Admin/ConfigurationControllerTest.phpindex 0c2364dc6a..dd307a0d39 100644--- a/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php+++ b/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php@@ -29,10 +29,6 @@ use Tests\TestCase;/*** Class ConfigurationControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class ConfigurationControllerTest extends TestCase{diff --git a/tests/Feature/Controllers/Admin/HomeControllerTest.php b/tests/Feature/Controllers/Admin/HomeControllerTest.phpindex 9d02ab892e..4a147aaaf4 100644--- a/tests/Feature/Controllers/Admin/HomeControllerTest.php+++ b/tests/Feature/Controllers/Admin/HomeControllerTest.php@@ -29,10 +29,6 @@ use Tests\TestCase;/*** Class HomeControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class HomeControllerTest extends TestCase{@@ -46,8 +42,7 @@ class HomeControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\HomeController::index- * @covers \FireflyIII\Http\Controllers\Admin\HomeController::__construct+ * @covers \FireflyIII\Http\Controllers\Admin\HomeController*/public function testIndex(): void{@@ -58,6 +53,9 @@ class HomeControllerTest extends TestCase$response->assertSee('<ol class="breadcrumb">');}+ /**+ * @covers \FireflyIII\Http\Controllers\Admin\HomeController+ */public function testTestMessage(): void{Event::fake();diff --git a/tests/Feature/Controllers/Admin/LinkControllerTest.php b/tests/Feature/Controllers/Admin/LinkControllerTest.phpindex 045cf02340..ccae616e9c 100644--- a/tests/Feature/Controllers/Admin/LinkControllerTest.php+++ b/tests/Feature/Controllers/Admin/LinkControllerTest.php@@ -30,10 +30,6 @@ use Tests\TestCase;/*** Class LinkControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class LinkControllerTest extends TestCase{@@ -47,8 +43,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::__construct- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::create+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController*/public function testCreate(): void{@@ -59,7 +54,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::delete+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController*/public function testDeleteEditable(): void{@@ -76,7 +71,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::delete+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController*/public function testDeleteNonEditable(): void{@@ -89,7 +84,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::destroy+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController*/public function testDestroy(): void{@@ -99,7 +94,7 @@ class LinkControllerTest extends TestCaseLinkType::create(['editable' => 1, 'inward' => 'hellox', 'outward' => 'byex', 'name' => 'Test typeX']);$linkType = LinkType::where('editable', 1)->first();- $repository->shouldReceive('find')->andReturn($linkType);+ $repository->shouldReceive('findNull')->andReturn($linkType);$repository->shouldReceive('destroy');$this->be($this->user());$this->session(['link_types.delete.uri' => 'http://localhost']);@@ -109,7 +104,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::edit+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController*/public function testEditEditable(): void{@@ -123,7 +118,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::edit+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController*/public function testEditNonEditable(): void{@@ -135,7 +130,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::index+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController*/public function testIndex(): void{@@ -149,7 +144,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::show+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController*/public function testShow(): void{@@ -160,7 +155,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::store+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController* @covers \FireflyIII\Http\Requests\LinkTypeFormRequest*/public function testStore(): void@@ -172,7 +167,7 @@ class LinkControllerTest extends TestCase'outward' => 'test outward' . random_int(1, 1000),];$repository->shouldReceive('store')->once()->andReturn(LinkType::first());- $repository->shouldReceive('find')->andReturn(LinkType::first());+ $repository->shouldReceive('findNull')->andReturn(LinkType::first());$this->session(['link_types.create.uri' => 'http://localhost']);$this->be($this->user());@@ -182,7 +177,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::store+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController* @covers \FireflyIII\Http\Requests\LinkTypeFormRequest*/public function testStoreRedirect(): void@@ -203,7 +198,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::update+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController* @covers \FireflyIII\Http\Requests\LinkTypeFormRequest*/public function testUpdate(): void@@ -227,7 +222,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::update+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController* @covers \FireflyIII\Http\Requests\LinkTypeFormRequest*/public function testUpdateNonEditable(): void@@ -249,7 +244,7 @@ class LinkControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\LinkController::update+ * @covers \FireflyIII\Http\Controllers\Admin\LinkController* @covers \FireflyIII\Http\Requests\LinkTypeFormRequest*/public function testUpdateRedirect(): voiddiff --git a/tests/Feature/Controllers/Admin/UpdateControllerTest.php b/tests/Feature/Controllers/Admin/UpdateControllerTest.phpindex 4bc08784c2..4b17eaf5cd 100644--- a/tests/Feature/Controllers/Admin/UpdateControllerTest.php+++ b/tests/Feature/Controllers/Admin/UpdateControllerTest.php@@ -34,10 +34,6 @@ use Tests\TestCase;/*** Class UpdateControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class UpdateControllerTest extends TestCase{@@ -51,8 +47,7 @@ class UpdateControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\UpdateController::index- * @covers \FireflyIII\Http\Controllers\Admin\UpdateController::__construct+ * @covers \FireflyIII\Http\Controllers\Admin\UpdateController*/public function testIndex(): void{@@ -75,7 +70,7 @@ class UpdateControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\UpdateController::post+ * @covers \FireflyIII\Http\Controllers\Admin\UpdateController*/public function testPost(): void{@@ -93,7 +88,7 @@ class UpdateControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\UpdateController::updateCheck+ * @covers \FireflyIII\Http\Controllers\Admin\UpdateController*/public function testUpdateCheck(): void{@@ -122,7 +117,7 @@ class UpdateControllerTest extends TestCase/**- * @covers \FireflyIII\Http\Controllers\Admin\UpdateController::updateCheck+ * @covers \FireflyIII\Http\Controllers\Admin\UpdateController*/public function testUpdateCheckCurrent(): void{@@ -149,7 +144,7 @@ class UpdateControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\UpdateController::updateCheck+ * @covers \FireflyIII\Http\Controllers\Admin\UpdateController*/public function testUpdateCheckError(): void{@@ -172,7 +167,7 @@ class UpdateControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\UpdateController::updateCheck+ * @covers \FireflyIII\Http\Controllers\Admin\UpdateController*/public function testUpdateCheckNewer(): void{diff --git a/tests/Feature/Controllers/Admin/UserControllerTest.php b/tests/Feature/Controllers/Admin/UserControllerTest.phpindex 36c1bb35d2..9b034f16d8 100644--- a/tests/Feature/Controllers/Admin/UserControllerTest.php+++ b/tests/Feature/Controllers/Admin/UserControllerTest.php@@ -29,10 +29,6 @@ use Tests\TestCase;/*** Class UserControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class UserControllerTest extends TestCase{@@ -46,7 +42,7 @@ class UserControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\UserController::delete+ * @covers \FireflyIII\Http\Controllers\Admin\UserController*/public function testDelete(): void{@@ -58,7 +54,7 @@ class UserControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\UserController::destroy+ * @covers \FireflyIII\Http\Controllers\Admin\UserController*/public function testDestroy(): void{@@ -71,7 +67,7 @@ class UserControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\UserController::edit+ * @covers \FireflyIII\Http\Controllers\Admin\UserController*/public function testEdit(): void{@@ -83,8 +79,7 @@ class UserControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\UserController::index- * @covers \FireflyIII\Http\Controllers\Admin\UserController::__construct+ * @covers \FireflyIII\Http\Controllers\Admin\UserController*/public function testIndex(): void{@@ -100,7 +95,7 @@ class UserControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\UserController::show+ * @covers \FireflyIII\Http\Controllers\Admin\UserController*/public function testShow(): void{@@ -121,7 +116,7 @@ class UserControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Admin\UserController::update+ * @covers \FireflyIII\Http\Controllers\Admin\UserController*/public function testUpdate(): void{diff --git a/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php b/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.phpindex c12dc98fbc..e20381f0ee 100644--- a/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php+++ b/tests/Feature/Controllers/Auth/ForgotPasswordControllerTest.php@@ -28,10 +28,6 @@ use Tests\TestCase;/*** Class ForgotPasswordControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class ForgotPasswordControllerTest extends TestCase{@@ -45,8 +41,7 @@ class ForgotPasswordControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController::__construct- * @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController::sendResetLinkEmail+ * @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController*/public function testSendResetLinkEmail(): void{@@ -62,8 +57,7 @@ class ForgotPasswordControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController::__construct- * @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController::sendResetLinkEmail+ * @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController*/public function testSendResetLinkEmailDemo(): void{diff --git a/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php b/tests/Feature/Controllers/Auth/TwoFactorControllerTest.phpindex 3caa680ce0..a7bd6e1f9f 100644--- a/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php+++ b/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php@@ -30,10 +30,6 @@ use Tests\TestCase;/*** Class TwoFactorControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class TwoFactorControllerTest extends TestCase{@@ -47,7 +43,7 @@ class TwoFactorControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::index+ * @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController*/public function testIndex(): void{@@ -70,7 +66,7 @@ class TwoFactorControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::index+ * @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController*/public function testIndexNo2FA(): void{@@ -92,7 +88,7 @@ class TwoFactorControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::index+ * @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController* @expectedExceptionMessage Your two factor authentication secret is empty*/public function testIndexNoSecret(): void@@ -116,7 +112,7 @@ class TwoFactorControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::lostTwoFactor+ * @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController*/public function testLostTwoFactor(): void{@@ -139,7 +135,7 @@ class TwoFactorControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::postIndex+ * @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController*/public function testPostIndex(): void{diff --git a/tests/Feature/Controllers/Chart/AccountControllerTest.php b/tests/Feature/Controllers/Chart/AccountControllerTest.phpindex a06bbad564..d58706adab 100644--- a/tests/Feature/Controllers/Chart/AccountControllerTest.php+++ b/tests/Feature/Controllers/Chart/AccountControllerTest.php@@ -43,10 +43,6 @@ use Tests\TestCase;/*** Class AccountControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class AccountControllerTest extends TestCase{@@ -60,8 +56,8 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseAccounts- * @covers \FireflyIII\Generator\Chart\Basic\GeneratorInterface::singleSet+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController+ * @covers \FireflyIII\Generator\Chart\Basic\GeneratorInterface* @dataProvider dateRangeProvider** @param string $range@@ -84,8 +80,7 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseBudget- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::getBudgetNames+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController* @dataProvider dateRangeProvider** @param string $range@@ -112,8 +107,7 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseBudgetAll- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::getBudgetNames+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController* @dataProvider dateRangeProvider** @param string $range@@ -142,8 +136,7 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseCategory- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::getCategoryNames+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController* @dataProvider dateRangeProvider** @param string $range@@ -171,8 +164,7 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseCategoryAll- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::getCategoryNames+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController* @dataProvider dateRangeProvider** @param string $range@@ -202,10 +194,8 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::frontpage- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::__construct- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::accountBalanceChart- * @covers \FireflyIII\Generator\Chart\Basic\GeneratorInterface::multiSet+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController+ * @covers \FireflyIII\Generator\Chart\Basic\GeneratorInterface* @dataProvider dateRangeProvider** @param string $range@@ -232,7 +222,7 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::incomeCategory+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController* @dataProvider dateRangeProvider** @param string $range@@ -260,7 +250,7 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::incomeCategoryAll+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController* @dataProvider dateRangeProvider** @param string $range@@ -290,7 +280,7 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::period+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController* @dataProvider dateRangeProvider** @param string $range@@ -311,8 +301,7 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::report- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::accountBalanceChart+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController*/public function testReport(): void{@@ -328,7 +317,7 @@ class AccountControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::revenueAccounts+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController* @dataProvider dateRangeProvider** @param string $rangediff --git a/tests/Feature/Controllers/Chart/BillControllerTest.php b/tests/Feature/Controllers/Chart/BillControllerTest.phpindex af5cd40359..f97bda2fe3 100644--- a/tests/Feature/Controllers/Chart/BillControllerTest.php+++ b/tests/Feature/Controllers/Chart/BillControllerTest.php@@ -32,10 +32,6 @@ use Tests\TestCase;/*** Class BillControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class BillControllerTest extends TestCase{@@ -49,8 +45,7 @@ class BillControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BillController::frontpage- * @covers \FireflyIII\Http\Controllers\Chart\BillController::__construct+ * @covers \FireflyIII\Http\Controllers\Chart\BillController* @dataProvider dateRangeProvider** @param string $range@@ -71,7 +66,7 @@ class BillControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BillController::single+ * @covers \FireflyIII\Http\Controllers\Chart\BillController*/public function testSingle(): void{diff --git a/tests/Feature/Controllers/Chart/BudgetControllerTest.php b/tests/Feature/Controllers/Chart/BudgetControllerTest.phpindex 876a2bdeee..83ec2fd3d6 100644--- a/tests/Feature/Controllers/Chart/BudgetControllerTest.php+++ b/tests/Feature/Controllers/Chart/BudgetControllerTest.php@@ -40,10 +40,6 @@ use Tests\TestCase;/*** Class BudgetControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class BudgetControllerTest extends TestCase{@@ -57,8 +53,7 @@ class BudgetControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::budget- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::__construct+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetController* @dataProvider dateRangeProvider** @param string $range@@ -79,7 +74,7 @@ class BudgetControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::budgetLimit+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetController* @dataProvider dateRangeProvider** @param string $range@@ -99,7 +94,7 @@ class BudgetControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::budgetLimit+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetController* @expectedExceptionMessage This budget limit is not part of this budget.*/public function testBudgetLimitWrongLimit(): void@@ -113,8 +108,7 @@ class BudgetControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::expenseAsset- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getAccountNames+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetController* @dataProvider dateRangeProvider** @param string $range@@ -142,8 +136,7 @@ class BudgetControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::expenseCategory- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getCategoryNames+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetController* @dataProvider dateRangeProvider** @param string $range@@ -176,8 +169,7 @@ class BudgetControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::expenseExpense- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getAccountNames+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetController* @dataProvider dateRangeProvider** @param string $range@@ -210,10 +202,7 @@ class BudgetControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::frontpage- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getExpensesForBudget- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodWithout- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodMulti+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetController* @dataProvider dateRangeProvider** @param string $range@@ -247,10 +236,7 @@ class BudgetControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::frontpage- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getExpensesForBudget- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodWithout- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodMulti+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetController* @dataProvider dateRangeProvider** @param string $range@@ -286,10 +272,7 @@ class BudgetControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::frontpage- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getExpensesForBudget- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodWithout- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodMulti+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetController* @dataProvider dateRangeProvider** @param string $range@@ -321,8 +304,7 @@ class BudgetControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::period- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getBudgetedInPeriod+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetController*/public function testPeriod(): void{@@ -342,7 +324,7 @@ class BudgetControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetController::periodNoBudget+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetController*/public function testPeriodNoBudget(): void{diff --git a/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php b/tests/Feature/Controllers/Chart/BudgetReportControllerTest.phpindex 7d21d2f3b1..94212dd4a8 100644--- a/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php+++ b/tests/Feature/Controllers/Chart/BudgetReportControllerTest.php@@ -39,10 +39,6 @@ use Tests\TestCase;/*** Class BudgetReportControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class BudgetReportControllerTest extends TestCase{@@ -56,8 +52,7 @@ class BudgetReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::accountExpense- * @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::__construct+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController*/public function testAccountExpense(): void{@@ -80,7 +75,7 @@ class BudgetReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::budgetExpense+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController*/public function testBudgetExpense(): void{@@ -102,10 +97,7 @@ class BudgetReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::mainChart- * @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::filterBudgetLimits- * @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::getExpenses- * @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::groupByBudget+ * @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController*/public function testMainChart(): void{diff --git a/tests/Feature/Controllers/Chart/CategoryControllerTest.php b/tests/Feature/Controllers/Chart/CategoryControllerTest.phpindex e21fe2e7a4..6113c09892 100644--- a/tests/Feature/Controllers/Chart/CategoryControllerTest.php+++ b/tests/Feature/Controllers/Chart/CategoryControllerTest.php@@ -35,10 +35,6 @@ use Tests\TestCase;/*** Class CategoryControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class CategoryControllerTest extends TestCase{@@ -52,8 +48,7 @@ class CategoryControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\CategoryController::all- * @covers \FireflyIII\Http\Controllers\Chart\CategoryController::__construct+ * @covers \FireflyIII\Http\Controllers\Chart\CategoryController* @dataProvider dateRangeProvider** @param string $range@@ -80,7 +75,7 @@ class CategoryControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\CategoryController::frontpage+ * @covers \FireflyIII\Http\Controllers\Chart\CategoryController* @dataProvider dateRangeProvider** @param string $range@@ -106,7 +101,7 @@ class CategoryControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\CategoryController::reportPeriod+ * @covers \FireflyIII\Http\Controllers\Chart\CategoryController*/public function testReportPeriod(): void{@@ -123,7 +118,7 @@ class CategoryControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\CategoryController::reportPeriodNoCategory+ * @covers \FireflyIII\Http\Controllers\Chart\CategoryController*/public function testReportPeriodNoCategory(): void{@@ -140,8 +135,7 @@ class CategoryControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\CategoryController::specificPeriod- * @covers \FireflyIII\Http\Controllers\Chart\CategoryController::makePeriodChart+ * @covers \FireflyIII\Http\Controllers\Chart\CategoryController* @dataProvider dateRangeProvider** @param string $rangediff --git a/tests/Feature/Controllers/Chart/CategoryReportControllerTest.php b/tests/Feature/Controllers/Chart/CategoryReportControllerTest.phpindex dbe80eb377..249b6fc428 100644--- a/tests/Feature/Controllers/Chart/CategoryReportControllerTest.php+++ b/tests/Feature/Controllers/Chart/CategoryReportControllerTest.php@@ -36,10 +36,6 @@ use Tests\TestCase;/*** Class CategoryReportControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class CategoryReportControllerTest extends TestCase{@@ -53,8 +49,7 @@ class CategoryReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::accountExpense- * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::__construct+ * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController*/public function testAccountExpense(): void{@@ -75,7 +70,7 @@ class CategoryReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::accountIncome+ * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController*/public function testAccountIncome(): void{@@ -96,7 +91,7 @@ class CategoryReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::categoryExpense+ * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController*/public function testCategoryExpense(): void{@@ -117,7 +112,7 @@ class CategoryReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::categoryIncome+ * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController*/public function testCategoryIncome(): void{@@ -138,10 +133,7 @@ class CategoryReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::mainChart- * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::groupByCategory- * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::getExpenses- * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::getIncome+ * @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController*/public function testMainChart(): void{diff --git a/tests/Feature/Controllers/Chart/ExpenseReportControllerTest.php b/tests/Feature/Controllers/Chart/ExpenseReportControllerTest.phpindex ede81ec9fd..e086ed0cfb 100644--- a/tests/Feature/Controllers/Chart/ExpenseReportControllerTest.php+++ b/tests/Feature/Controllers/Chart/ExpenseReportControllerTest.php@@ -33,10 +33,6 @@ use Tests\TestCase;/*** Class ExpenseReportControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class ExpenseReportControllerTest extends TestCase{@@ -51,12 +47,7 @@ class ExpenseReportControllerTest extends TestCase/**- * @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::__construct- * @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::groupByName- * @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::mainChart()- * @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::getExpenses- * @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::getIncome- * @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::combineAccounts+ * @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController*/public function testMainChart(): void{diff --git a/tests/Feature/Controllers/Chart/PiggyBankControllerTest.php b/tests/Feature/Controllers/Chart/PiggyBankControllerTest.phpindex e11d5b66c8..5ce714c013 100644--- a/tests/Feature/Controllers/Chart/PiggyBankControllerTest.php+++ b/tests/Feature/Controllers/Chart/PiggyBankControllerTest.php@@ -31,10 +31,6 @@ use Tests\TestCase;/*** Class PiggyBankControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class PiggyBankControllerTest extends TestCase{@@ -48,8 +44,7 @@ class PiggyBankControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\PiggyBankController::history- * @covers \FireflyIII\Http\Controllers\Chart\PiggyBankController::__construct+ * @covers \FireflyIII\Http\Controllers\Chart\PiggyBankController*/public function testHistory(): void{diff --git a/tests/Feature/Controllers/Chart/ReportControllerTest.php b/tests/Feature/Controllers/Chart/ReportControllerTest.phpindex c13b21cced..948a90c7d5 100644--- a/tests/Feature/Controllers/Chart/ReportControllerTest.php+++ b/tests/Feature/Controllers/Chart/ReportControllerTest.php@@ -30,10 +30,6 @@ use Tests\TestCase;/*** Class ReportControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class ReportControllerTest extends TestCase{@@ -47,9 +43,7 @@ class ReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\ReportController::netWorth- * @covers \FireflyIII\Http\Controllers\Chart\ReportController::arraySum- * @covers \FireflyIII\Http\Controllers\Chart\ReportController::__construct+ * @covers \FireflyIII\Http\Controllers\Chart\ReportController*/public function testNetWorth(): void{@@ -64,8 +58,7 @@ class ReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\ReportController::operations- * @covers \FireflyIII\Http\Controllers\Chart\ReportController::getChartData+ * @covers \FireflyIII\Http\Controllers\Chart\ReportController*/public function testOperations(): void{@@ -83,8 +76,7 @@ class ReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\ReportController::sum- * @covers \FireflyIII\Http\Controllers\Chart\ReportController::getChartData+ * @covers \FireflyIII\Http\Controllers\Chart\ReportController*/public function testSum(): void{diff --git a/tests/Feature/Controllers/Chart/TagReportControllerTest.php b/tests/Feature/Controllers/Chart/TagReportControllerTest.phpindex 8b016cc1a5..63d76ceec0 100644--- a/tests/Feature/Controllers/Chart/TagReportControllerTest.php+++ b/tests/Feature/Controllers/Chart/TagReportControllerTest.php@@ -40,10 +40,6 @@ use Tests\TestCase;/*** Class TagReportControllerTest- *- * @SuppressWarnings(PHPMD.TooManyPublicMethods)- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class TagReportControllerTest extends TestCase{@@ -57,8 +53,7 @@ class TagReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\TagReportController::accountExpense- * @covers \FireflyIII\Http\Controllers\Chart\TagReportController::__construct+ * @covers \FireflyIII\Http\Controllers\Chart\TagReportController*/public function testAccountExpense(): void{@@ -86,7 +81,7 @@ class TagReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\TagReportController::accountIncome+ * @covers \FireflyIII\Http\Controllers\Chart\TagReportController*/public function testAccountIncome(): void{@@ -113,7 +108,7 @@ class TagReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\TagReportController::budgetExpense()+ * @covers \FireflyIII\Http\Controllers\Chart\TagReportController*/public function testBudgetExpense(): void{@@ -139,7 +134,7 @@ class TagReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\TagReportController::categoryExpense()+ * @covers \FireflyIII\Http\Controllers\Chart\TagReportController*/public function testCategoryExpense(): void{@@ -165,10 +160,7 @@ class TagReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\TagReportController::mainChart()- * @covers \FireflyIII\Http\Controllers\Chart\TagReportController::getExpenses- * @covers \FireflyIII\Http\Controllers\Chart\TagReportController::getIncome- * @covers \FireflyIII\Http\Controllers\Chart\TagReportController::groupByTag+ * @covers \FireflyIII\Http\Controllers\Chart\TagReportController*/public function testMainChart(): void{@@ -207,7 +199,7 @@ class TagReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\TagReportController::tagExpense()+ * @covers \FireflyIII\Http\Controllers\Chart\TagReportController*/public function testTagExpense(): void{@@ -233,7 +225,7 @@ class TagReportControllerTest extends TestCase}/**- * @covers \FireflyIII\Http\Controllers\Chart\TagReportController::tagIncome+ * @covers \FireflyIII\Http\Controllers\Chart\TagReportController*/public function testTagIncome(): void{diff --git a/tests/Feature/Controllers/PiggyBankControllerTest.php b/tests/Feature/Controllers/PiggyBankControllerTest.phpindex 5361a41471..ef6129b5c1 100644--- a/tests/Feature/Controllers/PiggyBankControllerTest.php+++ b/tests/Feature/Controllers/PiggyBankControllerTest.php@@ -109,8 +109,6 @@ class PiggyBankControllerTest extends TestCase$currencyRepos->shouldReceive('findNull')->andReturn($currency);$accountRepos = $this->mock(AccountRepositoryInterface::class);- $accountRepos->shouldReceive('getAccountsByType')- ->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->andReturn(new Collection([$account]))->once();Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);Amount::shouldReceive('balance')->andReturn('0');@@ -196,13 +194,12 @@ class PiggyBankControllerTest extends TestCasepublic function testIndex(): void{// mock stuff- $repository = $this->mock(PiggyBankRepositoryInterface::class);- $journalRepos = $this->mock(JournalRepositoryInterface::class);- $one = factory(PiggyBank::class)->make();- $two = factory(PiggyBank::class)->make();- $two->account_id = $one->account_id;- $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);- $repository->shouldReceive('getPiggyBanks')->andReturn(new Collection([$one, $two]));+ $first = $this->user()->transactionJournals()->inRandomOrder()->first();+ $repository = $this->mock(PiggyBankRepositoryInterface::class);+ $journalRepos = $this->mock(JournalRepositoryInterface::class);+ $piggies = $this->user()->piggyBanks()->take(2)->get();+ $journalRepos->shouldReceive('firstNull')->once()->andReturn($first);+ $repository->shouldReceive('getPiggyBanks')->andReturn($piggies);$repository->shouldReceive('getCurrentAmount')->andReturn('10');$repository->shouldReceive('setUser');$repository->shouldReceive('correctOrder');@@ -350,10 +347,11 @@ class PiggyBankControllerTest extends TestCasepublic function testShow(): void{// mock stuff+ $first = $this->user()->transactionJournals()->inRandomOrder()->first();$repository = $this->mock(PiggyBankRepositoryInterface::class);$journalRepos = $this->mock(JournalRepositoryInterface::class);$repository->shouldReceive('setUser')->once();- $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);+ $journalRepos->shouldReceive('firstNull')->once()->andReturn($first);$repository->shouldReceive('getEvents')->andReturn(new Collection);$repository->shouldReceive('getSuggestedMonthlyAmount')->andReturn('1');$repository->shouldReceive('getCurrentAmount')->andReturn('1');diff --git a/tests/Feature/Controllers/Popup/ReportControllerTest.php b/tests/Feature/Controllers/Popup/ReportControllerTest.phpindex ae78a63c6b..ab2366932d 100644--- a/tests/Feature/Controllers/Popup/ReportControllerTest.php+++ b/tests/Feature/Controllers/Popup/ReportControllerTest.php@@ -173,43 +173,6 @@ class ReportControllerTest extends TestCase$response->assertStatus(200);}- /**- * @covers \FireflyIII\Http\Controllers\Popup\ReportController::general- * @covers \FireflyIII\Http\Controllers\Popup\ReportController::parseAttributes- * @covers \FireflyIII\Http\Controllers\Popup\ReportController::balanceAmount- */- public function testBalanceAmountDiffRole(): void- {- $categoryRepos = $this->mock(CategoryRepositoryInterface::class);- $accountRepos = $this->mock(AccountRepositoryInterface::class);- $budgetRepos = $this->mock(BudgetRepositoryInterface::class);- $popupHelper = $this->mock(PopupReportInterface::class);-- $budget = factory(Budget::class)->make();- $account = factory(Account::class)->make();-- $budgetRepos->shouldReceive('findNull')->andReturn($budget)->once()->withArgs([1]);- $accountRepos->shouldReceive('findNull')->andReturn($account)->once()->withArgs([1]);- $popupHelper->shouldReceive('balanceDifference')->once()->andReturn(new Collection);-- $this->be($this->user());- $arguments = [- 'attributes' => [- 'location' => 'balance-amount',- 'startDate' => Carbon::now()->startOfMonth()->format('Ymd'),- 'endDate' => Carbon::now()->endOfMonth()->format('Ymd'),- 'accounts' => 1,- 'accountId' => 1,- 'categoryId' => 1,- 'budgetId' => 1,- 'role' => 3, // diff role, is complicated.- ],- ];- $uri = route('popup.general') . '?' . http_build_query($arguments);- $response = $this->get($uri);- $response->assertStatus(200);- }-/*** @covers \FireflyIII\Http\Controllers\Popup\ReportController::general* @covers \FireflyIII\Http\Controllers\Popup\ReportController::parseAttributesdiff --git a/tests/Feature/Controllers/Transaction/ConvertControllerTest.php b/tests/Feature/Controllers/Transaction/ConvertControllerTest.phpindex 98b31601a9..413befc9ba 100644--- a/tests/Feature/Controllers/Transaction/ConvertControllerTest.php+++ b/tests/Feature/Controllers/Transaction/ConvertControllerTest.php@@ -25,7 +25,6 @@ namespace Tests\Feature\Controllers\Transaction;use Amount;use DB;use FireflyIII\Models\Account;-use FireflyIII\Models\AccountType;use FireflyIII\Models\TransactionCurrency;use FireflyIII\Models\TransactionJournal;use FireflyIII\Repositories\Account\AccountRepositoryInterface;@@ -64,7 +63,15 @@ class ConvertControllerTest extends TestCase// mock stuff:$journalRepos = $this->mock(JournalRepositoryInterface::class);- $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);+ // find deposit:+ $loop = 0;+ do {+ $deposit = TransactionJournal::where('transaction_type_id', 2)->inRandomOrder()->where('user_id', $this->user()->id)->first();+ $count = $deposit->transactions()->count();+ $loop++;+ } while ($count !== 2 && $loop < 30);++ $journalRepos->shouldReceive('firstNull')->andReturn($deposit);$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();@@ -75,15 +82,12 @@ class ConvertControllerTest extends TestCase$this->mock(CurrencyRepositoryInterface::class);$accountRepos = $this->mock(AccountRepositoryInterface::class);- $accountRepos->shouldReceive('getAccountsByType')- ->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->andReturn(new Collection([$account]))->once();- Amount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(3);+ Amount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(2);Amount::shouldReceive('formatAnything')->andReturn('0')->once();-$this->be($this->user());- $deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();+$response = $this->get(route('transactions.convert.index', ['transfer', $deposit->id]));$response->assertStatus(200);$response->assertSee('Convert a deposit into a transfer');@@ -96,7 +100,16 @@ class ConvertControllerTest extends TestCase{// mock stuff:$journalRepos = $this->mock(JournalRepositoryInterface::class);- $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);++ // find deposit:+ $loop = 0;+ do {+ $deposit = TransactionJournal::where('transaction_type_id', 2)->inRandomOrder()->where('user_id', $this->user()->id)->first();+ $count = $deposit->transactions()->count();+ $loop++;+ } while ($count !== 2 && $loop < 30);++ $journalRepos->shouldReceive('firstNull')->andReturn($deposit);$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();@@ -107,7 +120,7 @@ class ConvertControllerTest extends TestCaseAmount::shouldReceive('getDefaultCurrency')->andReturn($currency)->twice();Amount::shouldReceive('formatAnything')->andReturn('0')->once();- $deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();+$this->be($this->user());$response = $this->get(route('transactions.convert.index', ['withdrawal', $deposit->id]));$response->assertStatus(200);@@ -120,12 +133,21 @@ class ConvertControllerTest extends TestCasepublic function testIndexSameType(): void{// mock stuff:++ // find deposit:+ $loop = 0;+ do {+ $deposit = TransactionJournal::where('transaction_type_id', 2)->inRandomOrder()->where('user_id', $this->user()->id)->first();+ $count = $deposit->transactions()->count();+ $loop++;+ } while ($count !== 2 && $loop < 30);+$journalRepos = $this->mock(JournalRepositoryInterface::class);- $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);+ $journalRepos->shouldReceive('firstNull')->andReturn($deposit);$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();$this->be($this->user());- $deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();+$response = $this->get(route('transactions.convert.index', ['deposit', $deposit->id]));$response->assertStatus(302);$response->assertSessionHas('info');@@ -166,14 +188,21 @@ class ConvertControllerTest extends TestCasepublic function testIndexTransferDeposit(): void{// mock stuff:++ // find transfer:+ $loop = 0;+ do {+ $transfer = TransactionJournal::where('transaction_type_id', 3)->inRandomOrder()->where('user_id', $this->user()->id)->first();+ $count = $transfer->transactions()->count();+ $loop++;+ } while ($count !== 2 && $loop < 30);+$journalRepos = $this->mock(JournalRepositoryInterface::class);- $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);+ $journalRepos->shouldReceive('firstNull')->andReturn($transfer);$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();-- $transfer = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->first();$this->be($this->user());$response = $this->get(route('transactions.convert.index', ['deposit', $transfer->id]));$response->assertStatus(200);@@ -185,6 +214,14 @@ class ConvertControllerTest extends TestCase*/public function testIndexTransferWithdrawal(): void{+ // find transfer:+ $loop = 0;+ do {+ $transfer = TransactionJournal::where('transaction_type_id', 3)->inRandomOrder()->where('user_id', $this->user()->id)->first();+ $count = $transfer->transactions()->count();+ $loop++;+ } while ($count !== 2 && $loop < 30);+// mock stuff:$journalRepos = $this->mock(JournalRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);@@ -197,7 +234,6 @@ class ConvertControllerTest extends TestCaseAmount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(2);Amount::shouldReceive('formatAnything')->andReturn('0')->once();- $transfer = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->first();$this->be($this->user());$response = $this->get(route('transactions.convert.index', ['withdrawal', $transfer->id]));$response->assertStatus(200);@@ -209,6 +245,15 @@ class ConvertControllerTest extends TestCase*/public function testIndexWithdrawalDeposit(): void{++ // find withdrawal:+ $loop = 0;+ do {+ $withdrawal = TransactionJournal::where('transaction_type_id', 1)->inRandomOrder()->where('user_id', $this->user()->id)->first();+ $count = $withdrawal->transactions()->count();+ $loop++;+ } while ($count !== 2 && $loop < 30);+// mock stuff:$journalRepos = $this->mock(JournalRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);@@ -221,7 +266,6 @@ class ConvertControllerTest extends TestCaseAmount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(2);Amount::shouldReceive('formatAnything')->andReturn('0')->once();- $withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();$this->be($this->user());$response = $this->get(route('transactions.convert.index', ['deposit', $withdrawal->id]));$response->assertStatus(200);@@ -233,6 +277,14 @@ class ConvertControllerTest extends TestCase*/public function testIndexWithdrawalTransfer(): void{+ // find withdrawal:+ $loop = 0;+ do {+ $withdrawal = TransactionJournal::where('transaction_type_id', 1)->inRandomOrder()->where('user_id', $this->user()->id)->first();+ $count = $withdrawal->transactions()->count();+ $loop++;+ } while ($count !== 2 && $loop < 30);+// mock stuff:$journalRepos = $this->mock(JournalRepositoryInterface::class);$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);@@ -242,17 +294,13 @@ class ConvertControllerTest extends TestCase// mock stuff for new account list thing.$currency = TransactionCurrency::first();- $account = factory(Account::class)->make();$this->mock(CurrencyRepositoryInterface::class);$accountRepos = $this->mock(AccountRepositoryInterface::class);- $accountRepos->shouldReceive('getAccountsByType')- ->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->andReturn(new Collection([$account]))->once();- Amount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(3);+ Amount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(2);Amount::shouldReceive('formatAnything')->andReturn('0')->once();- $withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();$this->be($this->user());$response = $this->get(route('transactions.convert.index', ['transfer', $withdrawal->id]));$response->assertStatus(200);@@ -274,12 +322,6 @@ class ConvertControllerTest extends TestCase$accountRepos = $this->mock(AccountRepositoryInterface::class);$accountRepos->shouldReceive('find')->andReturn(new Account);- $account = $this->user()->accounts()->first();- $repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();- $repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();- $accountRepos->shouldReceive('findNull')->andReturn($account)->once();--$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();$data = ['source_account_asset' => 1];$this->be($this->user());@@ -304,8 +346,6 @@ class ConvertControllerTest extends TestCase$accountRepos = $this->mock(AccountRepositoryInterface::class);$accountRepos->shouldReceive('store')->andReturn(new Account);$account = $this->user()->accounts()->first();- $repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();- $repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();$data = ['destination_account_expense' => 'New expense name.'];@@ -328,15 +368,8 @@ class ConvertControllerTest extends TestCase$repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);$accountRepos = $this->mock(AccountRepositoryInterface::class);- $accountRepos->shouldReceive('getCashAccount')->andReturn(new Account)->once();-- $account = $this->user()->accounts()->first();- $repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();- $repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();--- $deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();- $data = ['destination_account_expense' => ''];+ $deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();+ $data = ['destination_account_expense' => ''];$this->be($this->user());$response = $this->post(route('transactions.convert.index', ['withdrawal', $deposit->id]), $data);$response->assertStatus(302);@@ -353,6 +386,14 @@ class ConvertControllerTest extends TestCase$accountRepos = $this->mock(AccountRepositoryInterface::class);$account = $this->user()->accounts()->first();+ // find withdrawal:+ $loop = 0;+ do {+ $withdrawal = TransactionJournal::where('transaction_type_id', 1)->inRandomOrder()->where('user_id', $this->user()->id)->first();+ $count = $withdrawal->transactions()->count();+ $loop++;+ } while ($count !== 2 && $loop < 30);+// mock stuff$messageBag = new MessageBag;@@ -364,10 +405,7 @@ class ConvertControllerTest extends TestCase$repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();$repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();$accountRepos->shouldReceive('findNull')->andReturn($account)->once();--- $withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();- $data = [+ $data = ['destination_account_asset' => 2,];$this->be($this->user());@@ -434,6 +472,14 @@ class ConvertControllerTest extends TestCase*/public function testPostIndexTransferDeposit(): void{+ // find transfer:+ $loop = 0;+ do {+ $transfer = TransactionJournal::where('transaction_type_id', 3)->inRandomOrder()->where('user_id', $this->user()->id)->first();+ $count = $transfer->transactions()->count();+ $loop++;+ } while ($count !== 2 && $loop < 30);+// mock stuff$repository = $this->mock(JournalRepositoryInterface::class);$repository->shouldReceive('convert')->andReturn(new MessageBag);@@ -446,8 +492,7 @@ class ConvertControllerTest extends TestCase$repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();$repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();- $transfer = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->first();- $data = ['source_account_revenue' => 'New rev'];+ $data = ['source_account_revenue' => 'New rev'];$this->be($this->user());$response = $this->post(route('transactions.convert.index', ['deposit', $transfer->id]), $data);$response->assertStatus(302);@@ -466,13 +511,6 @@ class ConvertControllerTest extends TestCase$repository->shouldReceive('convert')->andReturn(new MessageBag);$repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);- $accountRepos = $this->mock(AccountRepositoryInterface::class);- $accountRepos->shouldReceive('store')->andReturn(new Account)->once();-- $account = $this->user()->accounts()->first();- $repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();- $repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();-$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();$data = ['source_account_revenue' => 'New revenue name.'];$this->be($this->user());@@ -493,13 +531,6 @@ class ConvertControllerTest extends TestCase$repository->shouldReceive('convert')->andReturn(new MessageBag);$repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);- $accountRepos = $this->mock(AccountRepositoryInterface::class);- $accountRepos->shouldReceive('getCashAccount')->andReturn(new Account)->once();-- $account = $this->user()->accounts()->first();- $repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();- $repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();-$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();$data = ['source_account_revenue' => ''];$this->be($this->user());@@ -523,10 +554,6 @@ class ConvertControllerTest extends TestCase$accountRepos = $this->mock(AccountRepositoryInterface::class);$accountRepos->shouldReceive('findNull')->andReturn(new Account);- $account = $this->user()->accounts()->first();- $repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();- $repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();-$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();$data = ['destination_account_asset' => 2,];$this->be($this->user());diff --git a/tests/Feature/Controllers/Transaction/SingleControllerTest.php b/tests/Feature/Controllers/Transaction/SingleControllerTest.phpindex c0ef2c2ca8..563e7044ff 100644--- a/tests/Feature/Controllers/Transaction/SingleControllerTest.php+++ b/tests/Feature/Controllers/Transaction/SingleControllerTest.php@@ -33,7 +33,6 @@ use FireflyIII\Models\Note;use FireflyIII\Models\Transaction;use FireflyIII\Models\TransactionCurrency;use FireflyIII\Models\TransactionJournal;-use FireflyIII\Models\TransactionType;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;@@ -352,7 +351,7 @@ class SingleControllerTest extends TestCase$response->assertStatus(200);// has bread crumb$response->assertSee('<ol class="breadcrumb">');- $response->assertSee(' name="destinationt_name" type="text" value="">');+ $response->assertSee(' name="destination_name" type="text" value="">');}/**@@ -592,8 +591,8 @@ class SingleControllerTest extends TestCase'what' => 'withdrawal','amount' => '10','amount_currency_id_amount' => 1,- 'source_id' => 1,- 'destination_name' => 'Some destination',+ 'source_id' => 1,+ 'destination_name' => 'Some destination','date' => '2016-01-01','description' => 'Test descr',];@@ -645,8 +644,8 @@ class SingleControllerTest extends TestCase'what' => 'withdrawal','amount' => '10','amount_currency_id_amount' => 1,- 'source_id' => 1,- 'destination_name' => 'Some destination',+ 'source_id' => 1,+ 'destination_name' => 'Some destination','date' => '2016-01-01','description' => 'Test descr',];@@ -700,8 +699,8 @@ class SingleControllerTest extends TestCase'what' => 'deposit','amount' => '10','amount_currency_id_amount' => 1,- 'destination_id' => 1,- 'source_name' => 'Some source',+ 'destination_id' => 1,+ 'source_name' => 'Some source','date' => '2016-01-01','description' => 'Test descr',];@@ -756,8 +755,8 @@ class SingleControllerTest extends TestCase'what' => 'transfer','amount' => '10','amount_currency_id_amount' => 1,- 'destination_id' => 1,- 'source_id' => 2,+ 'destination_id' => 1,+ 'source_id' => 2,'date' => '2016-01-01','description' => 'Test descr',];@@ -814,8 +813,8 @@ class SingleControllerTest extends TestCase'amount_currency_id_amount' => 1,'source_account_currency' => 1,'destination_account_currency' => 2,- 'destination_id' => 1,- 'source_id' => 2,+ 'destination_id' => 1,+ 'source_id' => 2,'date' => '2016-01-01','description' => 'Test descr',];@@ -858,13 +857,15 @@ class SingleControllerTest extends TestCase$this->assertTrue(false, $e->getMessage());}- $journal = new TransactionJournal();- $type = TransactionType::find(1);- $journal->id = 1000;- $journal->description = 'New journal';- $journal->transactionType()->associate($type);+ // find withdrawal:+ $loop = 0;+ do {+ $withdrawal = TransactionJournal::where('transaction_type_id', 1)->inRandomOrder()->where('user_id', $this->user()->id)->first();+ $count = $withdrawal->transactions()->count();+ $loop++;+ } while ($count !== 2 && $loop < 30);- $journalRepos->shouldReceive('update')->andReturn($journal);+ $journalRepos->shouldReceive('update')->andReturn($withdrawal);$this->session(['transactions.edit.uri' => 'http://localhost']);$this->be($this->user());@@ -872,8 +873,8 @@ class SingleControllerTest extends TestCase'id' => 123,'what' => 'withdrawal','description' => 'Updated groceries',- 'source_id' => 1,- 'destination_name' => 'PLUS',+ 'source_id' => 1,+ 'destination_name' => 'PLUS','amount' => '123','amount_currency_id_amount' => 1,'budget_id' => 1,@@ -882,13 +883,13 @@ class SingleControllerTest extends TestCase'date' => '2016-01-01',];- $response = $this->post(route('transactions.update', [123]), $data);+ $response = $this->post(route('transactions.update', [$withdrawal->id]), $data);$response->assertStatus(302);$response->assertSessionHas('success');- $response = $this->get(route('transactions.show', [123]));+ $response = $this->get(route('transactions.show', [$withdrawal->id]));$response->assertStatus(200);- $response->assertSee('Updated groceries');+ $response->assertSee($withdrawal->description);// has bread crumb$response->assertSee('<ol class="breadcrumb">');}diff --git a/tests/Unit/Factory/TransactionFactoryTest.php b/tests/Unit/Factory/TransactionFactoryTest.phpindex a2a3d7dac3..f31966fa75 100644--- a/tests/Unit/Factory/TransactionFactoryTest.php+++ b/tests/Unit/Factory/TransactionFactoryTest.php@@ -696,7 +696,7 @@ class TransactionFactoryTest extends TestCase}/**- * Create transfer using minimal data.+ * Create reconciliation using minimal data.** @covers \FireflyIII\Factory\TransactionFactory* @covers \FireflyIII\Services\Internal\Support\TransactionServiceTraitdiff --git a/tests/Unit/Import/Routine/SpectreRoutineTest.php b/tests/Unit/Import/Routine/SpectreRoutineTest.phpindex 89d5947590..8267ed506c 100644--- a/tests/Unit/Import/Routine/SpectreRoutineTest.php+++ b/tests/Unit/Import/Routine/SpectreRoutineTest.php@@ -46,7 +46,7 @@ class SpectreRoutineTest extends TestCase{$job = new ImportJob;$job->user_id = $this->user()->id;- $job->key = 'SRA' . random_int(1, 1000);+ $job->key = 'SR1A' . random_int(1, 1000);$job->status = 'ready_to_run';$job->stage = 'do-authenticate';$job->provider = 'spectre';@@ -77,7 +77,7 @@ class SpectreRoutineTest extends TestCase{$job = new ImportJob;$job->user_id = $this->user()->id;- $job->key = 'SRA' . random_int(1, 1000);+ $job->key = 'SR2b' . random_int(1, 1000);$job->status = 'ready_to_run';$job->stage = 'authenticated';$job->provider = 'spectre';@@ -115,7 +115,7 @@ class SpectreRoutineTest extends TestCase{$job = new ImportJob;$job->user_id = $this->user()->id;- $job->key = 'SRA' . random_int(1, 1000);+ $job->key = 'SR3c' . random_int(1, 1000);$job->status = 'ready_to_run';$job->stage = 'go-for-import';$job->provider = 'spectre';@@ -154,7 +154,7 @@ class SpectreRoutineTest extends TestCase{$job = new ImportJob;$job->user_id = $this->user()->id;- $job->key = 'SRA' . random_int(1, 1000);+ $job->key = 'SR4A' . random_int(1, 1000);$job->status = 'ready_to_run';$job->stage = 'new';$job->provider = 'spectre';@@ -194,7 +194,7 @@ class SpectreRoutineTest extends TestCase{$job = new ImportJob;$job->user_id = $this->user()->id;- $job->key = 'SRA' . random_int(1, 1000);+ $job->key = 'SR5A' . random_int(1, 1000);$job->status = 'ready_to_run';$job->stage = 'new';$job->provider = 'spectre';diff --git a/tests/Unit/Middleware/SandstormTest.php b/tests/Unit/Middleware/SandstormTest.phpindex f309143691..e7afb03da5 100644--- a/tests/Unit/Middleware/SandstormTest.php+++ b/tests/Unit/Middleware/SandstormTest.php@@ -76,6 +76,7 @@ class SandstormTest extends TestCase$repository = $this->mock(UserRepositoryInterface::class);$repository->shouldReceive('count')->twice()->andReturn(1);+ $repository->shouldReceive('hasRole')->andReturn(true);$response = $this->get('/_test/sandstorm');$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());@@ -128,6 +129,7 @@ class SandstormTest extends TestCase$repository->shouldReceive('store')->once()->andReturn($this->user());$repository->shouldReceive('attachRole')->twice()->andReturn(true);$repository->shouldReceive('getRole')->once()->andReturn(new Role);+ $repository->shouldReceive('hasRole')->andReturn(false);$response = $this->get('/_test/sandstorm', ['X-Sandstorm-User-Id' => 'abcd']);$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());@@ -156,6 +158,7 @@ class SandstormTest extends TestCase$repository = $this->mock(UserRepositoryInterface::class);$repository->shouldReceive('count')->twice()->andReturn(1);$repository->shouldReceive('first')->once()->andReturn($this->user());+ $repository->shouldReceive('hasRole')->andReturn(true);$response = $this->get('/_test/sandstorm', ['X-Sandstorm-User-Id' => 'abcd']);$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());diff --git a/tests/Unit/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandlerTest.php b/tests/Unit/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandlerTest.phpindex a3e4548d48..ce2bb7022f 100644--- a/tests/Unit/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandlerTest.php+++ b/tests/Unit/Support/Import/JobConfiguration/Bunq/ChooseAccountsHandlerTest.php@@ -127,12 +127,14 @@ class ChooseAccountsHandlerTest extends TestCase'account_mapping' => ['1234' => '456',],+ 'apply_rules' => true,];$config = [- 'accounts' => [+ 'accounts' => [0 => ['id' => 1234, 'name' => 'bunq'],],+ 'apply-rules' => true,];$expected = $config;$expected['mapping'][1234] = 456;@@ -179,12 +181,14 @@ class ChooseAccountsHandlerTest extends TestCase'account_mapping' => ['1234' => '456',],+ 'apply_rules' => true,];$config = [- 'accounts' => [+ 'accounts' => [0 => ['id' => 1235, 'name' => 'bunq'],],+ 'apply-rules' => true,];$expected = $config;$expected['mapping'][0] = 456;@@ -231,12 +235,14 @@ class ChooseAccountsHandlerTest extends TestCase'account_mapping' => ['1234' => '456',],+ 'apply_rules' => true,];$config = [- 'accounts' => [+ 'accounts' => [0 => ['id' => 1234, 'name' => 'bunq'],],+ 'apply-rules' => true,];$expected = $config;$expected['mapping'][1234] = 0;@@ -279,11 +285,13 @@ class ChooseAccountsHandlerTest extends TestCase$job->save();// data:- $data = ['account_mapping' => []];+ $data = ['account_mapping' => [], 'apply_rules' => true,];$config = ['accounts' => [0 => ['id' => 1234, 'name' => 'bunq'],],+ 'apply-rules' => true,+];// mock stuffdiff --git a/tests/Unit/Support/Import/JobConfiguration/Bunq/NewBunqJobHandlerTest.php b/tests/Unit/Support/Import/JobConfiguration/Bunq/NewBunqJobHandlerTest.phpindex 45f7fe62a9..cc407f65dc 100644--- a/tests/Unit/Support/Import/JobConfiguration/Bunq/NewBunqJobHandlerTest.php+++ b/tests/Unit/Support/Import/JobConfiguration/Bunq/NewBunqJobHandlerTest.php@@ -48,16 +48,14 @@ class NewBunqJobHandlerTest extends TestCase$job->save();// expected config:- $expected = [- 'apply-rules' => true,- ];+ //$expected = [];// mock stuff$repository = $this->mock(ImportJobRepositoryInterface::class);// mock calls$repository->shouldReceive('setUser')->once();- $repository->shouldReceive('getConfiguration')->andReturn([])->once();- $repository->shouldReceive('setConfiguration')->withArgs([Mockery::any(), $expected])->once();+ //$repository->shouldReceive('getConfiguration')->andReturn([])->once();+ //$repository->shouldReceive('setConfiguration')->withArgs([Mockery::any(), $expected])->once();$handler = new NewBunqJobHandler();$handler->setImportJob($job);diff --git a/tests/Unit/Support/Import/JobConfiguration/Spectre/ChooseAccountsHandlerTest.php b/tests/Unit/Support/Import/JobConfiguration/Spectre/ChooseAccountsHandlerTest.phpindex 8c4ab5f197..6defb45701 100644--- a/tests/Unit/Support/Import/JobConfiguration/Spectre/ChooseAccountsHandlerTest.php+++ b/tests/Unit/Support/Import/JobConfiguration/Spectre/ChooseAccountsHandlerTest.php@@ -148,11 +148,13 @@ class ChooseAccountsHandlerTest extends TestCase// data to submit:$data = ['account_mapping' => [3131 => 872,],+ 'apply_rules' => true,];// expected configuration:$config = ['accounts' => [0 => ['id' => 3131, 'name' => 'Some fake account',],],'account_mapping' => [3131 => 872,],+ 'apply-rules' => true,];@@ -176,16 +178,16 @@ class ChooseAccountsHandlerTest extends TestCase}/**- * Case: Local account is invalid. Spectre account is valid.+ * Case: Local account is invalid. Spectre account is invalid.** @covers \FireflyIII\Support\Import\JobConfiguration\Spectre\ChooseAccountsHandler*/- public function testConfigureJobInvalidLocal(): void+ public function testConfigureJobInvalidBoth(): void{// fake job:$job = new ImportJob;$job->user_id = $this->user()->id;- $job->key = 'sca-D' . random_int(1, 1000);+ $job->key = 'sca-E' . random_int(1, 1000);$job->status = 'new';$job->stage = 'new';$job->provider = 'spectre';@@ -193,7 +195,7 @@ class ChooseAccountsHandlerTest extends TestCase$job->configuration = ['accounts' => [0 => [- 'id' => 3131,+ 'id' => 3134,'name' => 'Some fake account',],],@@ -203,11 +205,13 @@ class ChooseAccountsHandlerTest extends TestCase// data to submit:$data = ['account_mapping' => [3131 => 872,],+ 'apply_rules' => true,];// expected configuration:$config = [- 'accounts' => [0 => ['id' => 3131, 'name' => 'Some fake account',],],- 'account_mapping' => [3131 => 0,],+ 'accounts' => [0 => ['id' => 3134, 'name' => 'Some fake account',],],+ 'account_mapping' => [0 => 0,],+ 'apply-rules' => true,];@@ -227,20 +231,22 @@ class ChooseAccountsHandlerTest extends TestCase// call handler:$handler = new ChooseAccountsHandler();$handler->setImportJob($job);- $this->assertCount(0, $handler->configureJob($data));+ $result = $handler->configureJob($data);+ $this->assertCount(1, $result);+ $this->assertEquals('It seems you have not selected any accounts to import from.', $result->first());}/**- * Case: Local account is valid. Spectre account is invalid.+ * Case: Local account is invalid. Spectre account is valid.** @covers \FireflyIII\Support\Import\JobConfiguration\Spectre\ChooseAccountsHandler*/- public function testConfigureJobInvalidSpectre(): void+ public function testConfigureJobInvalidLocal(): void{// fake job:$job = new ImportJob;$job->user_id = $this->user()->id;- $job->key = 'sca-E' . random_int(1, 1000);+ $job->key = 'sca-D' . random_int(1, 1000);$job->status = 'new';$job->stage = 'new';$job->provider = 'spectre';@@ -248,23 +254,23 @@ class ChooseAccountsHandlerTest extends TestCase$job->configuration = ['accounts' => [0 => [- 'id' => 3134,+ 'id' => 3131,'name' => 'Some fake account',],],];$job->save();- $account = $this->user()->accounts()->inRandomOrder()->first();-// data to submit:$data = ['account_mapping' => [3131 => 872,],+ 'apply_rules' => true,];// expected configuration:$config = [- 'accounts' => [0 => ['id' => 3134, 'name' => 'Some fake account',],],- 'account_mapping' => [0 => 872,],+ 'accounts' => [0 => ['id' => 3131, 'name' => 'Some fake account',],],+ 'account_mapping' => [3131 => 0,],+ 'apply-rules' => true,];@@ -277,7 +283,7 @@ class ChooseAccountsHandlerTest extends TestCase$accountRepos->shouldReceive('setUser')->once();$currencyRepos->shouldReceive('setUser')->once();$importRepos->shouldReceive('setUser')->once();- $accountRepos->shouldReceive('findNull')->once()->withArgs([872])->andReturn($account);+ $accountRepos->shouldReceive('findNull')->once()->withArgs([872])->andReturn(null);$importRepos->shouldReceive('setConfiguration')->once()->withArgs([Mockery::any(), $config]);@@ -288,11 +294,11 @@ class ChooseAccountsHandlerTest extends TestCase}/**- * Case: Local account is invalid. Spectre account is invalid.+ * Case: Local account is valid. Spectre account is invalid.** @covers \FireflyIII\Support\Import\JobConfiguration\Spectre\ChooseAccountsHandler*/- public function testConfigureJobInvalidBoth(): void+ public function testConfigureJobInvalidSpectre(): void{// fake job:$job = new ImportJob;@@ -312,14 +318,18 @@ class ChooseAccountsHandlerTest extends TestCase];$job->save();+ $account = $this->user()->accounts()->inRandomOrder()->first();+// data to submit:$data = ['account_mapping' => [3131 => 872,],+ 'apply_rules' => true,];// expected configuration:$config = ['accounts' => [0 => ['id' => 3134, 'name' => 'Some fake account',],],- 'account_mapping' => [0 => 0,],+ 'account_mapping' => [0 => 872,],+ 'apply-rules' => true,];@@ -332,19 +342,16 @@ class ChooseAccountsHandlerTest extends TestCase$accountRepos->shouldReceive('setUser')->once();$currencyRepos->shouldReceive('setUser')->once();$importRepos->shouldReceive('setUser')->once();- $accountRepos->shouldReceive('findNull')->once()->withArgs([872])->andReturn(null);+ $accountRepos->shouldReceive('findNull')->once()->withArgs([872])->andReturn($account);$importRepos->shouldReceive('setConfiguration')->once()->withArgs([Mockery::any(), $config]);// call handler:$handler = new ChooseAccountsHandler();$handler->setImportJob($job);- $result =$handler->configureJob($data);- $this->assertCount(1, $result);- $this->assertEquals('It seems you have not selected any accounts to import from.', $result->first());+ $this->assertCount(0, $handler->configureJob($data));}-/*** @covers \FireflyIII\Support\Import\JobConfiguration\Spectre\ChooseAccountsHandler*/diff --git a/tests/Unit/Support/Import/Routine/File/CurrencyMapperTest.php b/tests/Unit/Support/Import/Routine/File/CurrencyMapperTest.phpindex b11708eb3b..7ee4ef9711 100644--- a/tests/Unit/Support/Import/Routine/File/CurrencyMapperTest.php+++ b/tests/Unit/Support/Import/Routine/File/CurrencyMapperTest.php@@ -61,8 +61,7 @@ class CurrencyMapperTest extends TestCase$repository = $this->mock(CurrencyRepositoryInterface::class);$repository->shouldReceive('setUser')->once();$repository->shouldReceive('findNull')->once()->withArgs([$currency->id])->andReturn(null);- $repository->shouldReceive('store')->once()- ->withArgs([['code' => null, 'name' => null, 'symbol' => null, 'decimal_places' => 2]])->andReturn(null);+$mapper = new CurrencyMapper();$mapper->setUser($this->user());@@ -161,9 +160,6 @@ class CurrencyMapperTest extends TestCase// mock data$repository = $this->mock(CurrencyRepositoryInterface::class);$repository->shouldReceive('setUser')->once();- $repository->shouldReceive('store')->once()- ->withArgs([['code' => null, 'name' => null, 'symbol' => null, 'decimal_places' => 2]])->andReturn(null);-$mapper = new CurrencyMapper();$mapper->setUser($this->user());diff --git a/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.php b/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.phpindex 9e8e32f608..d101303717 100644--- a/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.php+++ b/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.php@@ -148,6 +148,7 @@ class ImportableConverterTest extends TestCase$opposingMapper->shouldReceive('map')->once()->withArgs([null, '45.67', $nullAccount])->andReturn($other);$currencyMapper->shouldReceive('map')->once()->withArgs([null, ['name' => null, 'code' => null, 'symbol' => null]])->andReturn(null);$currencyMapper->shouldReceive('map')->once()->withArgs([null, ['code' => null]])->andReturn(null);+ $currencyMapper->shouldReceive('map')->times(2)->withArgs([$euro->id, []])->andReturn($euro);$converter = new ImportableConverter;@@ -173,7 +174,7 @@ class ImportableConverterTest extends TestCase$importable = new ImportTransaction;$importable->amount = '45.67';$importable->date = '20180917';- $importable->meta['date-book'] = '2018-01-02';+ $importable->meta['date-book'] = '20180102';$importables = [$importable];$job = $this->user()->importJobs()->first();@@ -221,7 +222,7 @@ class ImportableConverterTest extends TestCase$this->assertEquals($usd->id, $result[0]['transactions'][0]['currency_id']);$this->assertEquals($revenue->id, $result[0]['transactions'][0]['source_id']);$this->assertEquals($asset->id, $result[0]['transactions'][0]['destination_id']);- $this->assertEquals($importable->meta['date-book'], $result[0]['book_date']);+ $this->assertEquals('2018-01-02', $result[0]['book_date']);}@@ -291,8 +292,8 @@ class ImportableConverterTest extends TestCase$importable = new ImportTransaction;$importable->amount = '45.67';$importable->date = '20180917';- $importable->billId = 2; // will be ignored because it's not valid.- $importable->billName = 'Some Bill'; // will be included because bill ID is not valid.+ $importable->billId = 2; // will NOT be ignored despite it's not valid.+ $importable->billName = 'Some Bill'; // will always be included even when bill ID is not valid.$importables = [$importable];$job = $this->user()->importJobs()->first();@@ -337,7 +338,7 @@ class ImportableConverterTest extends TestCase$this->assertEquals('transfer', $result[0]['type']);$this->assertEquals('2018-09-17', $result[0]['date']);$this->assertEquals([], $result[0]['tags']);- $this->assertNull($result[0]['bill_id']);+ $this->assertEquals(2, $result[0]['bill_id']); // will NOT be ignored.$this->assertEquals($importable->billName, $result[0]['bill_name']);$this->assertEquals($usd->id, $result[0]['transactions'][0]['currency_id']);// since amount is positive, $asset recieves the money@@ -357,7 +358,7 @@ class ImportableConverterTest extends TestCase$importable->amount = '-45.67';$importable->date = '20180917';$importable->billId = 3; // is added to array of valid values, see below.- $importable->billName = 'Some bill'; // will be ignored because ID is valid.+ $importable->billName = 'Some bill'; // will be added even when ID is valid.$importables = [$importable];$validMappings = [@@ -408,7 +409,7 @@ class ImportableConverterTest extends TestCase$this->assertEquals('2018-09-17', $result[0]['date']);$this->assertEquals([], $result[0]['tags']);$this->assertEquals(3, $result[0]['bill_id']);- $this->assertNull($result[0]['bill_name']);+ $this->assertEquals($importable->billName, $result[0]['bill_name']);$this->assertEquals($usd->id, $result[0]['transactions'][0]['currency_id']);// since amount is negative, $asset sends the money$this->assertEquals($asset->id, $result[0]['transactions'][0]['source_id']);diff --git a/tests/Unit/Support/Import/Routine/Spectre/StageNewHandlerTest.php b/tests/Unit/Support/Import/Routine/Spectre/StageNewHandlerTest.phpindex 1b1271100f..2aeb598c0f 100644--- a/tests/Unit/Support/Import/Routine/Spectre/StageNewHandlerTest.php+++ b/tests/Unit/Support/Import/Routine/Spectre/StageNewHandlerTest.php@@ -97,6 +97,7 @@ class StageNewHandlerTest extends TestCase// create new customer:$ncRequest->shouldReceive('setUser')->once();$ncRequest->shouldReceive('getCustomer')->once()->andReturn($fakeCustomer);+ $ncRequest->shouldReceive('call')->once();// mock calls for repository:$repository->shouldReceive('setUser')->once();diff --git a/tests/Unit/TransactionRules/Triggers/CategoryIsTest.php b/tests/Unit/TransactionRules/Triggers/CategoryIsTest.phpindex 2fda7c1e74..2fa9dad4ab 100644--- a/tests/Unit/TransactionRules/Triggers/CategoryIsTest.php+++ b/tests/Unit/TransactionRules/Triggers/CategoryIsTest.php@@ -36,7 +36,11 @@ class CategoryIsTest extends TestCase*/public function testTriggeredJournal(): void{- $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();+ do {+ $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();+ $transactions = $journal->transactions()->count();+ } while ($transactions === 0);+$category = $journal->user->categories()->first();$journal->categories()->detach();$journal->categories()->save($category);@@ -52,7 +56,11 @@ class CategoryIsTest extends TestCase*/public function testTriggeredNotJournal(): void{- $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();+ do {+ $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();+ $transactions = $journal->transactions()->count();+ } while ($transactions === 0);+$category = $journal->user->categories()->first();$otherCategory = $journal->user->categories()->where('id', '!=', $category->id)->first();$journal->categories()->detach();@@ -69,7 +77,11 @@ class CategoryIsTest extends TestCase*/public function testTriggeredTransaction(): void{- $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();+ do {+ $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();+ $transactions = $journal->transactions()->count();+ } while ($transactions === 0);+$transaction = $journal->transactions()->first();$category = $journal->user->categories()->first();diff --git a/tests/Unit/TransactionRules/Triggers/ToAccountIsTest.php b/tests/Unit/TransactionRules/Triggers/ToAccountIsTest.phpindex 16f68cda1e..c47e72de14 100644--- a/tests/Unit/TransactionRules/Triggers/ToAccountIsTest.php+++ b/tests/Unit/TransactionRules/Triggers/ToAccountIsTest.php@@ -36,9 +36,13 @@ class ToAccountIsTest extends TestCase*/public function testTriggered(): void{- $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();- $transaction = $journal->transactions()->where('amount', '>', 0)->first();- $account = $transaction->account;+ $count = 0;+ do {+ $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();+ $transaction = $journal->transactions()->where('amount', '>', 0)->first();+ $account = $transaction->account;+ $count++;+ } while ($account === null && $count < 30);$trigger = ToAccountIs::makeFromStrings($account->name, false);$result = $trigger->triggered($journal);@@ -50,7 +54,13 @@ class ToAccountIsTest extends TestCase*/public function testTriggeredNot(): void{- $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();+ $count = 0;+ do {+ $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();+ $transaction = $journal->transactions()->where('amount', '>', 0)->first();+ $account = $transaction->account;+ $count++;+ } while ($account === null && $count < 30);$trigger = ToAccountIs::makeFromStrings('some name' . random_int(1, 234), false);$result = $trigger->triggered($journal);diff --git a/tests/Unit/Transformers/BillTransformerTest.php b/tests/Unit/Transformers/BillTransformerTest.phpindex c46b5e0157..4b64833ba8 100644--- a/tests/Unit/Transformers/BillTransformerTest.php+++ b/tests/Unit/Transformers/BillTransformerTest.php@@ -68,44 +68,6 @@ class BillTransformerTest extends TestCase$this->assertTrue($result['active']);}- /**- * Basic coverage with a note.- *- * @covers \FireflyIII\Transformers\BillTransformer::transform- */- public function testNote(): void- {-- $bill = Bill::create(- [- 'user_id' => $this->user()->id,- 'name' => 'Some bill ' . random_int(1, 10000),- 'match' => 'word,' . random_int(1, 10000),- 'amount_min' => 12.34,- 'amount_max' => 45.67,- 'date' => '2018-01-02',- 'transaction_currency_id' => 1,- 'repeat_freq' => 'weekly',- 'skip' => 0,- 'active' => 1,- ]- );- $noteText = 'I are a note ' . random_int(1, 10000);- Note::create(- [- 'noteable_id' => $bill->id,- 'noteable_type' => Bill::class,- 'text' => $noteText,- ]- );- $transformer = new BillTransformer(new ParameterBag);- $result = $transformer->transform($bill);-- $this->assertEquals($bill->name, $result['name']);- $this->assertEquals($noteText, $result['notes']);- $this->assertTrue($result['active']);- }-/*** Coverage for dates.*