diff --git a/tests/Api/V1/Controllers/AboutControllerTest.php b/tests/Api/V1/Controllers/AboutControllerTest.php index 68740c65fb..d3ffcb88e0 100644 --- a/tests/Api/V1/Controllers/AboutControllerTest.php +++ b/tests/Api/V1/Controllers/AboutControllerTest.php @@ -48,7 +48,7 @@ class AboutControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\AboutController::__construct * @covers \FireflyIII\Api\V1\Controllers\AboutController::about */ - public function testAbout() + public function testAbout(): void { // test API $response = $this->get('/api/v1/about'); @@ -67,7 +67,7 @@ class AboutControllerTest extends TestCase * * @covers \FireflyIII\Api\V1\Controllers\AboutController::user */ - public function testUser() + public function testUser(): void { // test API $response = $this->get('/api/v1/about/user'); diff --git a/tests/Api/V1/Controllers/AccountControllerTest.php b/tests/Api/V1/Controllers/AccountControllerTest.php index e6c024b7dc..77586a0008 100644 --- a/tests/Api/V1/Controllers/AccountControllerTest.php +++ b/tests/Api/V1/Controllers/AccountControllerTest.php @@ -52,7 +52,7 @@ class AccountControllerTest extends TestCase * * @covers \FireflyIII\Api\V1\Controllers\AccountController::delete */ - public function testDelete() + public function testDelete(): void { // mock stuff: $repository = $this->mock(AccountRepositoryInterface::class); @@ -76,7 +76,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\AccountController::index * @covers \FireflyIII\Api\V1\Controllers\AccountController::mapTypes */ - public function testIndex() + public function testIndex(): void { // create stuff $accounts = factory(Account::class, 10)->create(); @@ -115,7 +115,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll */ - public function testInvalidBalance() + public function testInvalidBalance(): void { // mock repositories $repository = $this->mock(AccountRepositoryInterface::class); @@ -157,7 +157,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll */ - public function testNoCreditCardData() + public function testNoCreditCardData(): void { // mock repositories $repository = $this->mock(AccountRepositoryInterface::class); @@ -199,7 +199,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll */ - public function testNoCurrencyInfo() + public function testNoCurrencyInfo(): void { // mock repositories $repository = $this->mock(AccountRepositoryInterface::class); @@ -236,7 +236,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\AccountController::show */ - public function testShow() + public function testShow(): void { // create stuff $account = $this->user()->accounts()->first(); @@ -273,7 +273,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll */ - public function testStoreNotUnique() + public function testStoreNotUnique(): void { // mock repositories $repository = $this->mock(AccountRepositoryInterface::class); @@ -315,7 +315,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll */ - public function testStoreValid() + public function testStoreValid(): void { // mock repositories $repository = $this->mock(AccountRepositoryInterface::class); @@ -359,7 +359,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules * @covers \FireflyIII\Api\V1\Requests\AccountRequest::getAll */ - public function testStoreWithCurrencyCode() + public function testStoreWithCurrencyCode(): void { // mock repositories $repository = $this->mock(AccountRepositoryInterface::class); @@ -405,7 +405,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\AccountController::update * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules */ - public function testUpdate() + public function testUpdate(): void { // mock repositories $repository = $this->mock(AccountRepositoryInterface::class); @@ -448,7 +448,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\AccountController::update * @covers \FireflyIII\Api\V1\Requests\AccountRequest::rules */ - public function testUpdateCurrencyCode() + public function testUpdateCurrencyCode(): void { // mock repositories $repository = $this->mock(AccountRepositoryInterface::class); diff --git a/tests/Api/V1/Controllers/BillControllerTest.php b/tests/Api/V1/Controllers/BillControllerTest.php index 7ea81bfc1a..76ab361ee3 100644 --- a/tests/Api/V1/Controllers/BillControllerTest.php +++ b/tests/Api/V1/Controllers/BillControllerTest.php @@ -52,7 +52,7 @@ class BillControllerTest extends TestCase * * @covers \FireflyIII\Api\V1\Controllers\BillController */ - public function testDelete() + public function testDelete(): void { // mock stuff: $repository = $this->mock(BillRepositoryInterface::class); @@ -73,7 +73,7 @@ class BillControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\BillController::__construct * @covers \FireflyIII\Api\V1\Controllers\BillController::index */ - public function testIndex() + public function testIndex(): void { // create stuff $bills = factory(Bill::class, 10)->create(); @@ -99,7 +99,7 @@ class BillControllerTest extends TestCase /** * @covers \FireflyIII\Api\V1\Controllers\BillController::show */ - public function testShow() + public function testShow(): void { // create stuff $bill = $this->user()->bills()->first(); @@ -127,7 +127,7 @@ class BillControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\BillRequest::getAll * @covers \FireflyIII\Api\V1\Requests\BillRequest::withValidator */ - public function testStoreMinOverMax() + public function testStoreMinOverMax(): void { // create stuff $bill = $this->user()->bills()->first(); @@ -172,7 +172,7 @@ class BillControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\BillRequest::authorize * @covers \FireflyIII\Api\V1\Requests\BillRequest::getAll */ - public function testStoreValid() + public function testStoreValid(): void { // create stuff $bill = $this->user()->bills()->first(); @@ -211,7 +211,7 @@ class BillControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\BillRequest::authorize * @covers \FireflyIII\Api\V1\Requests\BillRequest::getAll */ - public function testUpdateValid() + public function testUpdateValid(): void { // create stuff $bill = $this->user()->bills()->first(); diff --git a/tests/Api/V1/Controllers/TransactionControllerTest.php b/tests/Api/V1/Controllers/TransactionControllerTest.php index db4174b1b2..d4646cd950 100644 --- a/tests/Api/V1/Controllers/TransactionControllerTest.php +++ b/tests/Api/V1/Controllers/TransactionControllerTest.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace Tests\Api\V1\Controllers; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\JournalCollector; use FireflyIII\Helpers\Collector\JournalCollectorInterface; use FireflyIII\Helpers\Filter\NegativeAmountFilter; @@ -57,7 +58,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::__construct * @covers \FireflyIII\Api\V1\Controllers\TransactionController::delete */ - public function testDelete() + public function testDelete(): void { // mock stuff: $repository = $this->mock(JournalRepositoryInterface::class); @@ -81,7 +82,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailCurrencyCode() + public function testFailCurrencyCode(): void { // mock stuff: $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -128,7 +129,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailCurrencyId() + public function testFailCurrencyId(): void { // mock stuff: $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -174,7 +175,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailEmptyDescriptions() + public function testFailEmptyDescriptions(): void { // mock stuff: $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -226,7 +227,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailEmptySplitDescriptions() + public function testFailEmptySplitDescriptions(): void { // mock stuff: $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -284,7 +285,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\TransactionRequest * @covers \FireflyIII\Rules\BelongsUser */ - public function testFailExpenseID() + public function testFailExpenseID(): void { // mock stuff: $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -332,7 +333,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailExpenseName() + public function testFailExpenseName(): void { // mock stuff: $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -379,7 +380,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailNoAsset() + public function testFailNoAsset(): void { // mock stuff: $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -423,7 +424,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailNoData() + public function testFailNoData(): void { // mock stuff: $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -460,7 +461,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailNoForeignCurrencyInfo() + public function testFailNoForeignCurrencyInfo(): void { // mock stuff: $account = $this->user()->accounts()->where('account_type_id', 3)->first(); @@ -508,7 +509,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailOpposingRevenueID() + public function testFailOpposingRevenueID(): void { $account = $this->user()->accounts()->where('account_type_id', 3)->first(); $opposing = $this->user()->accounts()->where('account_type_id', 5)->first(); @@ -561,7 +562,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\TransactionRequest * @covers \FireflyiII\Rules\BelongsUser */ - public function testFailOwnershipBillId() + public function testFailOwnershipBillId(): void { $account = $this->user()->accounts()->where('account_type_id', 3)->first(); $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -620,7 +621,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\TransactionRequest * @covers \FireflyiII\Rules\BelongsUser */ - public function testFailOwnershipBillName() + public function testFailOwnershipBillName(): void { $account = $this->user()->accounts()->where('account_type_id', 3)->first(); $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -678,7 +679,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\TransactionRequest * @covers \FireflyiII\Rules\BelongsUser */ - public function testFailOwnershipBudgetId() + public function testFailOwnershipBudgetId(): void { $account = $this->user()->accounts()->where('account_type_id', 3)->first(); $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -736,7 +737,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\TransactionRequest * @covers \FireflyiII\Rules\BelongsUser */ - public function testFailOwnershipBudgetName() + public function testFailOwnershipBudgetName(): void { $account = $this->user()->accounts()->where('account_type_id', 3)->first(); $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -794,7 +795,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\TransactionRequest * @covers \FireflyiII\Rules\BelongsUser */ - public function testFailOwnershipCategoryId() + public function testFailOwnershipCategoryId(): void { $account = $this->user()->accounts()->where('account_type_id', 3)->first(); $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -852,7 +853,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\TransactionRequest * @covers \FireflyiII\Rules\BelongsUser */ - public function testFailOwnershipPiggyBankID() + public function testFailOwnershipPiggyBankID(): void { // move account to other user $move = $this->user()->accounts()->where('account_type_id', 3)->first(); @@ -918,7 +919,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\TransactionRequest * @covers \FireflyiII\Rules\BelongsUser */ - public function testFailOwnershipPiggyBankName() + public function testFailOwnershipPiggyBankName(): void { // move account to other user $move = $this->user()->accounts()->where('account_type_id', 3)->first(); @@ -984,7 +985,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Requests\TransactionRequest * @covers \FireflyIII\Rules\BelongsUser */ - public function testFailRevenueID() + public function testFailRevenueID(): void { $account = $this->user()->accounts()->where('account_type_id', 4)->first(); $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -1030,7 +1031,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailSplitDeposit() + public function testFailSplitDeposit(): void { $account = $this->user()->accounts()->where('account_type_id', 3)->first(); $second = $this->user()->accounts()->where('account_type_id', 3)->where('id', '!=', $account->id)->first(); @@ -1087,7 +1088,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailSplitTransfer() + public function testFailSplitTransfer(): void { $account = $this->user()->accounts()->where('account_type_id', 3)->first(); $second = $this->user()->accounts()->where('account_type_id', 3)->where('id', '!=', $account->id)->first(); @@ -1151,7 +1152,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testFailSplitWithdrawal() + public function testFailSplitWithdrawal(): void { $account = $this->user()->accounts()->where('account_type_id', 3)->first(); $second = $this->user()->accounts()->where('account_type_id', 3)->where('id', '!=', $account->id)->first(); @@ -1210,7 +1211,7 @@ class TransactionControllerTest extends TestCase * * throws \FireflyIII\Exceptions\FireflyException */ - public function testIndex() + public function testIndex(): void { $accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos->shouldReceive('setUser'); @@ -1223,7 +1224,11 @@ class TransactionControllerTest extends TestCase $collector->withOpposingAccount()->withCategoryInformation()->withBudgetInformation(); $collector->setAllAssetAccounts(); $collector->setLimit(5)->setPage(1); - $paginator = $collector->getPaginatedJournals(); + try { + $paginator = $collector->getPaginatedJournals(); + } catch (FireflyException $e) { + $this->assertTrue(false, $e->getMessage()); + } // mock stuff: $repository = $this->mock(JournalRepositoryInterface::class); @@ -1260,7 +1265,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::mapTypes * throws \FireflyIII\Exceptions\FireflyException */ - public function testIndexWithRange() + public function testIndexWithRange(): void { $accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos->shouldReceive('setUser'); @@ -1273,7 +1278,11 @@ class TransactionControllerTest extends TestCase $collector->withOpposingAccount()->withCategoryInformation()->withBudgetInformation(); $collector->setAllAssetAccounts(); $collector->setLimit(5)->setPage(1); + try { $paginator = $collector->getPaginatedJournals(); + } catch (FireflyException $e) { + $this->assertTrue(false, $e->getMessage()); + } // mock stuff: $repository = $this->mock(JournalRepositoryInterface::class); @@ -1321,7 +1330,7 @@ class TransactionControllerTest extends TestCase /** * @covers \FireflyIII\Api\V1\Controllers\TransactionController::show */ - public function testShowDeposit() + public function testShowDeposit(): void { do { // this is kind of cheating but OK. @@ -1382,7 +1391,7 @@ class TransactionControllerTest extends TestCase /** * @covers \FireflyIII\Api\V1\Controllers\TransactionController::show */ - public function testShowWithdrawal() + public function testShowWithdrawal(): void { do { // this is kind of cheating but OK. @@ -1450,7 +1459,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessBillId() + public function testSuccessBillId(): void { // default journal: $journal = $this->user()->transactionJournals()->first(); @@ -1491,7 +1500,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessBillName() + public function testSuccessBillName(): void { // default journal: $journal = $this->user()->transactionJournals()->first(); @@ -1532,7 +1541,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessNewStoreOpposingName() + public function testSuccessNewStoreOpposingName(): void { $journal = $this->user()->transactionJournals()->where('transaction_type_id', 1)->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first(); @@ -1572,7 +1581,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreAccountName() + public function testSuccessStoreAccountName(): void { // default journal: $journal = $this->user()->transactionJournals()->first(); @@ -1611,7 +1620,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreBasic() + public function testSuccessStoreBasic(): void { // default journal: $journal = $this->user()->transactionJournals()->where('transaction_type_id', 1)->first(); @@ -1650,7 +1659,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreBasicByName() + public function testSuccessStoreBasicByName(): void { // default journal: $journal = $this->user()->transactionJournals()->where('transaction_type_id', 1)->first(); @@ -1691,7 +1700,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreBasicDeposit() + public function testSuccessStoreBasicDeposit(): void { // default journal: $journal = $this->user()->transactionJournals()->where('transaction_type_id', 2)->first(); @@ -1730,7 +1739,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreBudgetId() + public function testSuccessStoreBudgetId(): void { $budget = $this->user()->budgets()->first(); $journal = $this->user()->transactionJournals()->first(); @@ -1769,7 +1778,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreBudgetName() + public function testSuccessStoreBudgetName(): void { $budget = $this->user()->budgets()->first(); $journal = $this->user()->transactionJournals()->first(); @@ -1809,7 +1818,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreCategoryID() + public function testSuccessStoreCategoryID(): void { $category = $this->user()->categories()->first(); $journal = $this->user()->transactionJournals()->first(); @@ -1848,7 +1857,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreCategoryName() + public function testSuccessStoreCategoryName(): void { $category = $this->user()->categories()->first(); $journal = $this->user()->transactionJournals()->first(); @@ -1887,7 +1896,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreForeignAmount() + public function testSuccessStoreForeignAmount(): void { $currency = TransactionCurrency::first(); $foreign = TransactionCurrency::where('id', '!=', $currency->id)->first(); @@ -1928,7 +1937,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreMetaData() + public function testSuccessStoreMetaData(): void { $journal = $this->user()->transactionJournals()->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first(); @@ -1973,7 +1982,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreNewCategoryName() + public function testSuccessStoreNewCategoryName(): void { $journal = $this->user()->transactionJournals()->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first(); @@ -2013,7 +2022,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreNewOpposingName() + public function testSuccessStoreNewOpposingName(): void { $journal = $this->user()->transactionJournals()->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first(); @@ -2053,7 +2062,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreNotes() + public function testSuccessStoreNotes(): void { $journal = $this->user()->transactionJournals()->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first(); @@ -2092,7 +2101,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreOpposingID() + public function testSuccessStoreOpposingID(): void { $opposing = $this->user()->accounts()->where('account_type_id', 4)->first(); $journal = $this->user()->transactionJournals()->first(); @@ -2131,7 +2140,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreOpposingName() + public function testSuccessStoreOpposingName(): void { $opposing = $this->user()->accounts()->where('account_type_id', 4)->first(); $journal = $this->user()->transactionJournals()->first(); @@ -2172,7 +2181,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStorePiggyDeposit() + public function testSuccessStorePiggyDeposit(): void { $journal = $this->user()->transactionJournals()->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first(); @@ -2211,7 +2220,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStorePiggyId() + public function testSuccessStorePiggyId(): void { $source = $this->user()->accounts()->where('account_type_id', 3)->first(); $dest = $this->user()->accounts()->where('account_type_id', 3)->where('id', '!=', $source->id)->first(); @@ -2251,7 +2260,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStorePiggyName() + public function testSuccessStorePiggyName(): void { $source = $this->user()->accounts()->where('account_type_id', 3)->first(); $dest = $this->user()->accounts()->where('account_type_id', 3)->where('id', '!=', $source->id)->first(); @@ -2290,7 +2299,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreReconciled() + public function testSuccessStoreReconciled(): void { $journal = $this->user()->transactionJournals()->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first(); @@ -2328,7 +2337,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreSplit() + public function testSuccessStoreSplit(): void { $journal = $this->user()->transactionJournals()->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->first(); @@ -2375,7 +2384,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::store * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testSuccessStoreTags() + public function testSuccessStoreTags(): void { $tags = [ 'TagOne' . random_int(1, 1000), @@ -2419,7 +2428,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::update * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testUpdateBasicDeposit() + public function testUpdateBasicDeposit(): void { $account = $this->user()->accounts()->where('account_type_id', 3)->first(); $repository = $this->mock(JournalRepositoryInterface::class); @@ -2460,7 +2469,7 @@ class TransactionControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\TransactionController::update * @covers \FireflyIII\Api\V1\Requests\TransactionRequest */ - public function testUpdateBasicWithdrawal() + public function testUpdateBasicWithdrawal(): void { $account = $this->user()->accounts()->where('account_type_id', 3)->first(); $repository = $this->mock(JournalRepositoryInterface::class); diff --git a/tests/Api/V1/Controllers/UserControllerTest.php b/tests/Api/V1/Controllers/UserControllerTest.php index 3fd0e2a69d..7db9ea3925 100644 --- a/tests/Api/V1/Controllers/UserControllerTest.php +++ b/tests/Api/V1/Controllers/UserControllerTest.php @@ -54,7 +54,7 @@ class UserControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\UserController::delete * @covers \FireflyIII\Api\V1\Requests\UserRequest */ - public function testDelete() + public function testDelete(): void { // create a user first: $user = User::create(['email' => 'some@newu' . random_int(1, 1000) . 'ser.nl', 'password' => 'hello', 'blocked' => 0]); @@ -72,7 +72,7 @@ class UserControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\UserController::delete * @covers \FireflyIII\Api\V1\Requests\UserRequest */ - public function testDeleteNoAdmin() + public function testDeleteNoAdmin(): void { Passport::actingAs($this->emptyUser()); @@ -89,7 +89,7 @@ class UserControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\UserController::__construct * @covers \FireflyIII\Api\V1\Controllers\UserController::index */ - public function testIndex() + public function testIndex(): void { // create stuff $users = factory(User::class, 10)->create(); @@ -113,7 +113,7 @@ class UserControllerTest extends TestCase /** * @covers \FireflyIII\Api\V1\Controllers\UserController::show */ - public function testShow() + public function testShow(): void { $user = User::first(); @@ -127,7 +127,7 @@ class UserControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\UserController::store * @covers \FireflyIII\Api\V1\Requests\UserRequest */ - public function testStoreBasic() + public function testStoreBasic(): void { $data = [ 'email' => 'some_new@user' . random_int(1, 1000) . '.com', @@ -148,7 +148,7 @@ class UserControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\UserController::store * @covers \FireflyIII\Api\V1\Requests\UserRequest */ - public function testStoreNotUnique() + public function testStoreNotUnique(): void { $data = [ 'email' => $this->user()->email, @@ -177,7 +177,7 @@ class UserControllerTest extends TestCase * @covers \FireflyIII\Api\V1\Controllers\UserController::update * @covers \FireflyIII\Api\V1\Requests\UserRequest */ - public function testUpdate() + public function testUpdate(): void { // create a user first: $user = User::create(['email' => 'some@newu' . random_int(1, 1000) . 'ser.nl', 'password' => 'hello', 'blocked' => 0]); diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index ee73d4b36a..712aeec11c 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -36,7 +36,7 @@ trait CreatesApplication * * @return \Illuminate\Foundation\Application */ - public function createApplication() + public function createApplication(): \Illuminate\Foundation\Application { $app = require __DIR__ . '/../bootstrap/app.php'; diff --git a/tests/Feature/Controllers/Account/ReconcileControllerTest.php b/tests/Feature/Controllers/Account/ReconcileControllerTest.php index ccdfe0bd25..f549fb9a2e 100644 --- a/tests/Feature/Controllers/Account/ReconcileControllerTest.php +++ b/tests/Feature/Controllers/Account/ReconcileControllerTest.php @@ -56,7 +56,7 @@ class ReconcileControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::edit */ - public function testEdit() + public function testEdit(): void { $repository = $this->mock(JournalRepositoryInterface::class); $journal = $this->user()->transactionJournals()->where('transaction_type_id', 5)->first(); @@ -78,7 +78,7 @@ class ReconcileControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::edit */ - public function testEditRedirect() + public function testEditRedirect(): void { $journal = $this->user()->transactionJournals()->where('transaction_type_id', '!=', 5)->first(); $this->be($this->user()); @@ -90,7 +90,7 @@ class ReconcileControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::overview() */ - public function testOverview() + public function testOverview(): void { $transactions = $this->user()->transactions()->inRandomOrder()->take(3)->get(); $repository = $this->mock(JournalRepositoryInterface::class); @@ -112,7 +112,7 @@ class ReconcileControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::overview() * @expectedExceptionMessage is not an asset account */ - public function testOverviewNotAsset() + public function testOverviewNotAsset(): void { $account = $this->user()->accounts()->where('account_type_id', '!=', 3)->first(); $parameters = [ @@ -131,7 +131,7 @@ class ReconcileControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile() * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount() */ - public function testReconcile() + public function testReconcile(): void { $repository = $this->mock(CurrencyRepositoryInterface::class); $repository->shouldReceive('findNull')->once()->andReturn(TransactionCurrency::find(1)); @@ -148,7 +148,7 @@ class ReconcileControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile() * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount() */ - public function testReconcileInitialBalance() + public function testReconcileInitialBalance(): void { $transaction = Transaction::leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') ->where('accounts.user_id', $this->user()->id)->where('accounts.account_type_id', 6)->first(['account_id']); @@ -162,7 +162,7 @@ class ReconcileControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile() * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount() */ - public function testReconcileNoDates() + public function testReconcileNoDates(): void { $repository = $this->mock(CurrencyRepositoryInterface::class); $repository->shouldReceive('findNull')->once()->andReturn(TransactionCurrency::find(1)); @@ -180,7 +180,7 @@ class ReconcileControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile() * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount() */ - public function testReconcileNoEndDate() + public function testReconcileNoEndDate(): void { $repository = $this->mock(CurrencyRepositoryInterface::class); $repository->shouldReceive('findNull')->once()->andReturn(TransactionCurrency::find(1)); @@ -198,7 +198,7 @@ class ReconcileControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile() * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount() */ - public function testReconcileNotAsset() + public function testReconcileNotAsset(): void { $account = $this->user()->accounts()->where('account_type_id', '!=', 6)->where('account_type_id', '!=', 3)->first(); $this->be($this->user()); @@ -209,7 +209,7 @@ class ReconcileControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::show() */ - public function testShow() + public function testShow(): void { $journal = $this->user()->transactionJournals()->where('transaction_type_id', 5)->first(); $repository = $this->mock(JournalRepositoryInterface::class); @@ -227,7 +227,7 @@ class ReconcileControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::show() */ - public function testShowSomethingElse() + public function testShowSomethingElse(): void { $journal = $this->user()->transactionJournals()->where('transaction_type_id', '!=', 5)->first(); $this->be($this->user()); @@ -240,7 +240,7 @@ class ReconcileControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::submit() * @covers \FireflyIII\Http\Requests\ReconciliationStoreRequest */ - public function testSubmit() + public function testSubmit(): void { $repository = $this->mock(AccountRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -268,7 +268,7 @@ class ReconcileControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::transactions() */ - public function testTransactions() + public function testTransactions(): void { $repository = $this->mock(CurrencyRepositoryInterface::class); $repository->shouldReceive('findNull')->once()->andReturn(TransactionCurrency::find(1)); @@ -281,7 +281,7 @@ class ReconcileControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::transactions() */ - public function testTransactionsInitialBalance() + public function testTransactionsInitialBalance(): void { $transaction = Transaction::leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') ->where('accounts.user_id', $this->user()->id)->where('accounts.account_type_id', 6)->first(['account_id']); @@ -294,7 +294,7 @@ class ReconcileControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::update * @covers \FireflyIII\Http\Requests\ReconciliationUpdateRequest */ - public function testUpdate() + public function testUpdate(): void { $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal); @@ -317,7 +317,7 @@ class ReconcileControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::update * @covers \FireflyIII\Http\Requests\ReconciliationUpdateRequest */ - public function testUpdateNotReconcile() + public function testUpdateNotReconcile(): void { $journal = $this->user()->transactionJournals()->where('transaction_type_id', '!=', 5)->first(); $data = [ @@ -334,7 +334,7 @@ class ReconcileControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Account\ReconcileController::update * @covers \FireflyIII\Http\Requests\ReconciliationUpdateRequest */ - public function testUpdateZero() + public function testUpdateZero(): void { $journal = $this->user()->transactionJournals()->where('transaction_type_id', 5)->first(); $data = [ diff --git a/tests/Feature/Controllers/AccountControllerTest.php b/tests/Feature/Controllers/AccountControllerTest.php index 4357050385..290a766cc6 100644 --- a/tests/Feature/Controllers/AccountControllerTest.php +++ b/tests/Feature/Controllers/AccountControllerTest.php @@ -64,7 +64,7 @@ class AccountControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\AccountController::create */ - public function testCreate() + public function testCreate(): void { // mock stuff $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -84,7 +84,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\AccountController::delete * @covers \FireflyIII\Http\Controllers\Controller::rememberPreviousUri */ - public function testDelete() + public function testDelete(): void { // mock stuff $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -106,7 +106,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Controller::__construct * @covers \FireflyIII\Http\Controllers\Controller::getPreviousUri */ - public function testDestroy() + public function testDestroy(): void { // mock stuff $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -128,7 +128,7 @@ class AccountControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\AccountController::edit */ - public function testEdit() + public function testEdit(): void { $note = new Note(); $note->text = 'This is a test'; @@ -168,7 +168,7 @@ class AccountControllerTest extends TestCase * @param string $range * */ - public function testIndex(string $range) + public function testIndex(string $range): void { // mock stuff $account = factory(Account::class)->make(); @@ -199,7 +199,7 @@ class AccountControllerTest extends TestCase * * @param string $range */ - public function testShow(string $range) + public function testShow(string $range): void { $date = new Carbon; $this->session(['start' => $date, 'end' => clone $date]); @@ -243,7 +243,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\AccountController::show * @expectedExceptionMessage End is after start! */ - public function testShowBrokenBadDates() + public function testShowBrokenBadDates(): void { // mock $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -262,7 +262,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\AccountController::redirectToOriginalAccount * @expectedExceptionMessage Expected a transaction */ - public function testShowBrokenInitial() + public function testShowBrokenInitial(): void { // mock $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -283,7 +283,7 @@ class AccountControllerTest extends TestCase * * @param string $range */ - public function testShowByDateEmpty(string $range) + public function testShowByDateEmpty(string $range): void { // mock stuff $collector = $this->mock(JournalCollectorInterface::class); @@ -318,7 +318,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\AccountController::show * @covers \FireflyIII\Http\Controllers\AccountController::redirectToOriginalAccount */ - public function testShowInitial() + public function testShowInitial(): void { // mock stuff $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -339,7 +339,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Http\Requests\AccountFormRequest * @covers \FireflyIII\Http\Controllers\Controller::getPreviousUri */ - public function testStore() + public function testStore(): void { // mock stuff $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -368,7 +368,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Http\Requests\AccountFormRequest * @covers \FireflyIII\Http\Controllers\Controller::getPreviousUri */ - public function testStoreAnother() + public function testStoreAnother(): void { // mock stuff $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -395,7 +395,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Http\Requests\AccountFormRequest * @covers \FireflyIII\Http\Controllers\Controller::getPreviousUri */ - public function testUpdate() + public function testUpdate(): void { // mock stuff $journalRepos = $this->mock(JournalRepositoryInterface::class); @@ -422,7 +422,7 @@ class AccountControllerTest extends TestCase * @covers \FireflyIII\Http\Requests\AccountFormRequest * @covers \FireflyIII\Http\Controllers\Controller::getPreviousUri */ - public function testUpdateAgain() + public function testUpdateAgain(): void { // mock stuff $journalRepos = $this->mock(JournalRepositoryInterface::class); diff --git a/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php b/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php index ad63174d66..0c2364dc6a 100644 --- a/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php +++ b/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php @@ -49,7 +49,7 @@ class ConfigurationControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::index * @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::__construct */ - public function testIndex() + public function testIndex(): void { $this->be($this->user()); @@ -72,7 +72,7 @@ class ConfigurationControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::postIndex */ - public function testPostIndex() + public function testPostIndex(): void { $falseConfig = new Configuration; $falseConfig->data = false; diff --git a/tests/Feature/Controllers/Admin/HomeControllerTest.php b/tests/Feature/Controllers/Admin/HomeControllerTest.php index 74f94d125b..9d02ab892e 100644 --- a/tests/Feature/Controllers/Admin/HomeControllerTest.php +++ b/tests/Feature/Controllers/Admin/HomeControllerTest.php @@ -49,7 +49,7 @@ class HomeControllerTest extends TestCase * @covers \FireflyIII\Http\Controllers\Admin\HomeController::index * @covers \FireflyIII\Http\Controllers\Admin\HomeController::__construct */ - public function testIndex() + public function testIndex(): void { $this->be($this->user()); $response = $this->get(route('admin.index')); @@ -58,7 +58,7 @@ class HomeControllerTest extends TestCase $response->assertSee('