Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Updated tests to understand encrypted database content.
James Cole94e2f9b6dce2
diff --git a/tests/functional/TransactionControllerCest.php b/tests/functional/TransactionControllerCest.phpindex 6bd5444ad7..f9e40d8062 100644--- a/tests/functional/TransactionControllerCest.php+++ b/tests/functional/TransactionControllerCest.php@@ -29,7 +29,11 @@ class TransactionControllerCestpublic function deleteWithdrawal(FunctionalTester $I){- $journal = TransactionJournal::where('description', 'LIKE', '%Rent for %')->first();+ // get withdrawal transaction type id:+ $type = TransactionType::whereType('Withdrawal')->first();++ // get a journal+ $journal = TransactionJournal::where('transaction_type_id', $type->id)->first();$I->wantTo('delete a transaction');$I->amOnPage('/transaction/delete/' . $journal->id);$I->see('Delete withdrawal "' . $journal->description . '"');@@ -37,7 +41,11 @@ class TransactionControllerCestpublic function destroyDeposit(FunctionalTester $I){- $journal = TransactionJournal::where('description', 'LIKE', '%Salary for %')->first();+ // get withdrawal transaction type id:+ $type = TransactionType::whereType('Deposit')->first();++ // get a journal+ $journal = TransactionJournal::where('transaction_type_id', $type->id)->first();$I->wantTo('destroy a deposit');$I->amOnPage('/transaction/delete/' . $journal->id);$I->submitForm('#destroy', []);@@ -47,9 +55,13 @@ class TransactionControllerCestpublic function destroyTransfer(FunctionalTester $I){- $I->wantTo('destroy a transfer');+ // get withdrawal transaction type id:+ $type = TransactionType::whereType('Transfer')->first();- $journal = TransactionJournal::where('description', 'LIKE', '%Money for big expense in%')->first();+ // get a journal+ $journal = TransactionJournal::where('transaction_type_id', $type->id)->first();++ $I->wantTo('destroy a transfer');$I->amOnPage('/transaction/delete/' . $journal->id);$I->submitForm('#destroy', []);@@ -59,7 +71,12 @@ class TransactionControllerCestpublic function destroyWithdrawal(FunctionalTester $I){- $journal = TransactionJournal::where('description', 'LIKE', '%Rent for %')->first();+ // get withdrawal transaction type id:+ $type = TransactionType::whereType('Withdrawal')->first();++ // get a journal+ $journal = TransactionJournal::where('transaction_type_id', $type->id)->first();+$I->wantTo('destroy a withdrawal');$I->amOnPage('/transaction/delete/' . $journal->id);$I->submitForm('#destroy', []);@@ -69,10 +86,15 @@ class TransactionControllerCestpublic function edit(FunctionalTester $I){- $journal = TransactionJournal::whereDescription('Money for piggy')->first();+ // get withdrawal transaction type id:+ $type = TransactionType::whereType('Transfer')->first();++ // get a journal+ $journal = TransactionJournal::where('transaction_type_id', $type->id)->first();+$I->wantTo('edit a transaction');$I->amOnPage('/transaction/edit/' . $journal->id);- $I->see('Edit transfer "Money for piggy"');+ $I->see('Edit transfer "' . $journal->description . '"');}public function index(FunctionalTester $I)@@ -98,7 +120,11 @@ class TransactionControllerCestpublic function show(FunctionalTester $I){- $journal = TransactionJournal::where('description', 'LIKE', '%Rent for %')->first();+ // get withdrawal transaction type id:+ $type = TransactionType::whereType('Withdrawal')->first();++ // get a journal+ $journal = TransactionJournal::where('transaction_type_id', $type->id)->first();$I->wantTo('see a transaction');$I->amOnPage('/transaction/show/' . $journal->id);@@ -106,15 +132,22 @@ class TransactionControllerCest$I->see(intval($journal->getAmount()));}+ /**+ * @param FunctionalTester $I+ */public function showGroupedJournal(FunctionalTester $I){- $journal = TransactionJournal::where('description', 'LIKE', 'Big expense in %')->first();+ $groupRow = DB::table('transaction_group_transaction_journal')->select('transaction_journal_id')->first(['transaction_journal_id']);++ $id = $groupRow->transaction_journal_id;++ // get a grouped journal:+ $journal = TransactionJournal::find($id);$I->wantTo('see a grouped transaction');$I->amOnPage('/transaction/show/' . $journal->id);$I->see($journal->description);- $I->see('Money for ' . $journal->description);}public function store(FunctionalTester $I)@@ -137,72 +170,75 @@ class TransactionControllerCest$I->see('Transaction "Test" stored.');}-- public function storeValidate(FunctionalTester $I)+ public function storeAndFail(FunctionalTester $I){- $I->wantTo('validate a transaction');+ $I->wantTo('store a transaction and fail');$I->amOnPage('/transactions/create/withdrawal');$I->submitForm('#store', ['reminder' => '',- 'description' => 'TestValidateMe',+ 'description' => '','account_id' => 1,'expense_account' => 'Zomaar','amount' => 100,'date' => '2014-12-30','budget_id' => 3,- 'category' => 'CategorrXXXXr',- 'post_submit_action' => 'validate_only'+ 'category' => 'Categorrr',+ 'post_submit_action' => 'store']);- $I->see('OK');- $I->seeInSession('successes');- $I->dontSeeRecord('transaction_journals', ['description' => 'TestValidateMe']);+ $I->see('Could not store transaction: The description field is required.');}- public function storeAndFail(FunctionalTester $I)+ public function storeAndReturn(FunctionalTester $I){- $I->wantTo('store a transaction and fail');+ $I->wantTo('store a transaction');$I->amOnPage('/transactions/create/withdrawal');$I->submitForm('#store', ['reminder' => '',- 'description' => '',+ 'description' => 'Test','account_id' => 1,'expense_account' => 'Zomaar','amount' => 100,'date' => '2014-12-30','budget_id' => 3,'category' => 'Categorrr',- 'post_submit_action' => 'store'+ 'post_submit_action' => 'create_another']);- $I->see('Could not store transaction: The description field is required.');+ $I->see('Transaction "Test" stored.');}- public function storeAndReturn(FunctionalTester $I)+ public function storeValidate(FunctionalTester $I){- $I->wantTo('store a transaction');+ $I->wantTo('validate a transaction');$I->amOnPage('/transactions/create/withdrawal');$I->submitForm('#store', ['reminder' => '',- 'description' => 'Test',+ 'description' => 'TestValidateMe','account_id' => 1,'expense_account' => 'Zomaar','amount' => 100,'date' => '2014-12-30','budget_id' => 3,- 'category' => 'Categorrr',- 'post_submit_action' => 'create_another'+ 'category' => 'CategorrXXXXr',+ 'post_submit_action' => 'validate_only']);- $I->see('Transaction "Test" stored.');+ $I->see('OK');+ $I->seeInSession('successes');+ $I->dontSeeRecord('transaction_journals', ['description' => 'TestValidateMe']);}public function update(FunctionalTester $I){- $journal = TransactionJournal::where('description', 'LIKE', '%Salary for %')->first();+ // get withdrawal transaction type id:+ $type = TransactionType::whereType('Deposit')->first();++ // get a journal+ $journal = TransactionJournal::where('transaction_type_id', $type->id)->first();$I->wantTo('update a transaction');$I->amOnPage('/transaction/edit/' . $journal->id);@@ -222,33 +258,13 @@ class TransactionControllerCest$I->see($journal->description . '!');}- public function updateValidate(FunctionalTester $I)- {- $journal = TransactionJournal::where('description', 'LIKE', '%Salary for %')->first();-- $I->wantTo('validate an updated transaction');- $I->amOnPage('/transaction/edit/' . $journal->id);- $I->see($journal->description);- $I->submitForm(- '#update', [- 'description' => $journal->description . 'XYZ',- 'account_id' => 1,- 'expense_account' => 'Portaal',- 'amount' => 500,- 'date' => $journal->date->format('Y-m-d'),- 'budget_id' => is_null($journal->budgets()->first()) ? 0 : $journal->budgets()->first()->id,- 'category' => is_null($journal->categories()->first()) ? '' : $journal->categories()->first()->id,- 'post_submit_action' => 'validate_only'- ]- );- $I->see($journal->description . 'XYZ');- $I->see('OK');- $I->seeInSession('successes');- }-public function updateAndFail(FunctionalTester $I){- $journal = TransactionJournal::where('description', 'LIKE', '%Salary for %')->first();+ // get withdrawal transaction type id:+ $type = TransactionType::whereType('Deposit')->first();++ // get a journal+ $journal = TransactionJournal::where('transaction_type_id', $type->id)->first();$I->wantTo('update a transaction and fail');$I->amOnPage('/transaction/edit/' . $journal->id);@@ -270,7 +286,11 @@ class TransactionControllerCestpublic function updateAndReturn(FunctionalTester $I){- $journal = TransactionJournal::where('description', 'LIKE', '%Salary for %')->first();+ // get withdrawal transaction type id:+ $type = TransactionType::whereType('Deposit')->first();++ // get a journal+ $journal = TransactionJournal::where('transaction_type_id', $type->id)->first();$I->wantTo('update a transaction and return to the edit screen');$I->amOnPage('/transaction/edit/' . $journal->id);$I->see($journal->description);@@ -289,5 +309,33 @@ class TransactionControllerCest$I->see($journal->description . '!');}+ public function updateValidate(FunctionalTester $I)+ {+ // get withdrawal transaction type id:+ $type = TransactionType::whereType('Deposit')->first();++ // get a journal+ $journal = TransactionJournal::where('transaction_type_id', $type->id)->first();++ $I->wantTo('validate an updated transaction');+ $I->amOnPage('/transaction/edit/' . $journal->id);+ $I->see($journal->description);+ $I->submitForm(+ '#update', [+ 'description' => $journal->description . 'XYZ',+ 'account_id' => 1,+ 'expense_account' => 'Portaal',+ 'amount' => 500,+ 'date' => $journal->date->format('Y-m-d'),+ 'budget_id' => is_null($journal->budgets()->first()) ? 0 : $journal->budgets()->first()->id,+ 'category' => is_null($journal->categories()->first()) ? '' : $journal->categories()->first()->id,+ 'post_submit_action' => 'validate_only'+ ]+ );+ $I->see($journal->description . 'XYZ');+ $I->see('OK');+ $I->seeInSession('successes');+ }+}