mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-29 02:11:12 -06:00
Updated tests to understand encrypted database content.
This commit is contained in:
parent
512b81ad93
commit
94e2f9b6dc
@ -29,7 +29,11 @@ class TransactionControllerCest
|
|||||||
|
|
||||||
public function deleteWithdrawal(FunctionalTester $I)
|
public 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->wantTo('delete a transaction');
|
||||||
$I->amOnPage('/transaction/delete/' . $journal->id);
|
$I->amOnPage('/transaction/delete/' . $journal->id);
|
||||||
$I->see('Delete withdrawal "' . $journal->description . '"');
|
$I->see('Delete withdrawal "' . $journal->description . '"');
|
||||||
@ -37,7 +41,11 @@ class TransactionControllerCest
|
|||||||
|
|
||||||
public function destroyDeposit(FunctionalTester $I)
|
public 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->wantTo('destroy a deposit');
|
||||||
$I->amOnPage('/transaction/delete/' . $journal->id);
|
$I->amOnPage('/transaction/delete/' . $journal->id);
|
||||||
$I->submitForm('#destroy', []);
|
$I->submitForm('#destroy', []);
|
||||||
@ -47,9 +55,13 @@ class TransactionControllerCest
|
|||||||
|
|
||||||
public function destroyTransfer(FunctionalTester $I)
|
public 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->amOnPage('/transaction/delete/' . $journal->id);
|
||||||
$I->submitForm('#destroy', []);
|
$I->submitForm('#destroy', []);
|
||||||
@ -59,7 +71,12 @@ class TransactionControllerCest
|
|||||||
|
|
||||||
public function destroyWithdrawal(FunctionalTester $I)
|
public 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->wantTo('destroy a withdrawal');
|
||||||
$I->amOnPage('/transaction/delete/' . $journal->id);
|
$I->amOnPage('/transaction/delete/' . $journal->id);
|
||||||
$I->submitForm('#destroy', []);
|
$I->submitForm('#destroy', []);
|
||||||
@ -69,10 +86,15 @@ class TransactionControllerCest
|
|||||||
|
|
||||||
public function edit(FunctionalTester $I)
|
public 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->wantTo('edit a transaction');
|
||||||
$I->amOnPage('/transaction/edit/' . $journal->id);
|
$I->amOnPage('/transaction/edit/' . $journal->id);
|
||||||
$I->see('Edit transfer "Money for piggy"');
|
$I->see('Edit transfer "' . $journal->description . '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index(FunctionalTester $I)
|
public function index(FunctionalTester $I)
|
||||||
@ -98,7 +120,11 @@ class TransactionControllerCest
|
|||||||
|
|
||||||
public function show(FunctionalTester $I)
|
public 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->wantTo('see a transaction');
|
||||||
$I->amOnPage('/transaction/show/' . $journal->id);
|
$I->amOnPage('/transaction/show/' . $journal->id);
|
||||||
@ -106,15 +132,22 @@ class TransactionControllerCest
|
|||||||
$I->see(intval($journal->getAmount()));
|
$I->see(intval($journal->getAmount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
public function showGroupedJournal(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->wantTo('see a grouped transaction');
|
||||||
$I->amOnPage('/transaction/show/' . $journal->id);
|
$I->amOnPage('/transaction/show/' . $journal->id);
|
||||||
$I->see($journal->description);
|
$I->see($journal->description);
|
||||||
$I->see('Money for ' . $journal->description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(FunctionalTester $I)
|
public function store(FunctionalTester $I)
|
||||||
@ -137,29 +170,6 @@ class TransactionControllerCest
|
|||||||
$I->see('Transaction "Test" stored.');
|
$I->see('Transaction "Test" stored.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function storeValidate(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('validate a transaction');
|
|
||||||
$I->amOnPage('/transactions/create/withdrawal');
|
|
||||||
$I->submitForm(
|
|
||||||
'#store', [
|
|
||||||
'reminder' => '',
|
|
||||||
'description' => 'TestValidateMe',
|
|
||||||
'account_id' => 1,
|
|
||||||
'expense_account' => 'Zomaar',
|
|
||||||
'amount' => 100,
|
|
||||||
'date' => '2014-12-30',
|
|
||||||
'budget_id' => 3,
|
|
||||||
'category' => 'CategorrXXXXr',
|
|
||||||
'post_submit_action' => 'validate_only'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$I->see('OK');
|
|
||||||
$I->seeInSession('successes');
|
|
||||||
$I->dontSeeRecord('transaction_journals', ['description' => 'TestValidateMe']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function storeAndFail(FunctionalTester $I)
|
public function storeAndFail(FunctionalTester $I)
|
||||||
{
|
{
|
||||||
$I->wantTo('store a transaction and fail');
|
$I->wantTo('store a transaction and fail');
|
||||||
@ -200,9 +210,35 @@ class TransactionControllerCest
|
|||||||
$I->see('Transaction "Test" stored.');
|
$I->see('Transaction "Test" stored.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function storeValidate(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('validate a transaction');
|
||||||
|
$I->amOnPage('/transactions/create/withdrawal');
|
||||||
|
$I->submitForm(
|
||||||
|
'#store', [
|
||||||
|
'reminder' => '',
|
||||||
|
'description' => 'TestValidateMe',
|
||||||
|
'account_id' => 1,
|
||||||
|
'expense_account' => 'Zomaar',
|
||||||
|
'amount' => 100,
|
||||||
|
'date' => '2014-12-30',
|
||||||
|
'budget_id' => 3,
|
||||||
|
'category' => 'CategorrXXXXr',
|
||||||
|
'post_submit_action' => 'validate_only'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$I->see('OK');
|
||||||
|
$I->seeInSession('successes');
|
||||||
|
$I->dontSeeRecord('transaction_journals', ['description' => 'TestValidateMe']);
|
||||||
|
}
|
||||||
|
|
||||||
public function update(FunctionalTester $I)
|
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->wantTo('update a transaction');
|
||||||
$I->amOnPage('/transaction/edit/' . $journal->id);
|
$I->amOnPage('/transaction/edit/' . $journal->id);
|
||||||
@ -222,33 +258,13 @@ class TransactionControllerCest
|
|||||||
$I->see($journal->description . '!');
|
$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)
|
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->wantTo('update a transaction and fail');
|
||||||
$I->amOnPage('/transaction/edit/' . $journal->id);
|
$I->amOnPage('/transaction/edit/' . $journal->id);
|
||||||
@ -270,7 +286,11 @@ class TransactionControllerCest
|
|||||||
|
|
||||||
public function updateAndReturn(FunctionalTester $I)
|
public 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->wantTo('update a transaction and return to the edit screen');
|
||||||
$I->amOnPage('/transaction/edit/' . $journal->id);
|
$I->amOnPage('/transaction/edit/' . $journal->id);
|
||||||
$I->see($journal->description);
|
$I->see($journal->description);
|
||||||
@ -289,5 +309,33 @@ class TransactionControllerCest
|
|||||||
$I->see($journal->description . '!');
|
$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');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user