Skip to content

Firefly III: a personal finances manager

Last tests for transaction controller.

James Cole578298580edb
diff --git a/tests/functional/TransactionControllerCest.php b/tests/functional/TransactionControllerCest.php
index f253f34f95..ab85e29be6 100644
--- a/tests/functional/TransactionControllerCest.php
+++ b/tests/functional/TransactionControllerCest.php
@@ -34,15 +34,6 @@ class TransactionControllerCest
$I->see('Delete withdrawal "Huur Portaal for January 2014"');
}
- public function destroyWithdrawal(FunctionalTester $I)
- {
- $I->wantTo('destroy a withdrawal');
- $I->amOnPage('/transaction/delete/3');
- $I->submitForm('#destroy', []);
- $I->see('Transaction "Huur Portaal for January 2014" destroyed.');
-
- }
-
public function destroyDeposit(FunctionalTester $I)
{
$I->wantTo('destroy a deposit');
@@ -61,6 +52,15 @@ class TransactionControllerCest
}
+ public function destroyWithdrawal(FunctionalTester $I)
+ {
+ $I->wantTo('destroy a withdrawal');
+ $I->amOnPage('/transaction/delete/3');
+ $I->submitForm('#destroy', []);
+ $I->see('Transaction "Huur Portaal for January 2014" destroyed.');
+
+ }
+
public function edit(FunctionalTester $I)
{
$I->wantTo('edit a transaction');
@@ -101,6 +101,61 @@ class TransactionControllerCest
{
$I->wantTo('store a transaction');
$I->amOnPage('/transactions/create/withdrawal');
+ $I->submitForm(
+ '#store', [
+ 'reminder' => '',
+ 'description' => 'Test',
+ 'account_id' => 1,
+ 'expense_account' => 'Zomaar',
+ 'amount' => 100,
+ 'date' => '2014-12-30',
+ 'budget_id' => 3,
+ 'category' => 'Categorrr',
+ 'post_submit_action' => 'store'
+ ]
+ );
+ $I->see('Transaction "Test" stored.');
+ }
+
+ public function storeAndReturn(FunctionalTester $I)
+ {
+ $I->wantTo('store a transaction');
+ $I->amOnPage('/transactions/create/withdrawal');
+ $I->submitForm(
+ '#store', [
+ 'reminder' => '',
+ 'description' => 'Test',
+ 'account_id' => 1,
+ 'expense_account' => 'Zomaar',
+ 'amount' => 100,
+ 'date' => '2014-12-30',
+ 'budget_id' => 3,
+ 'category' => 'Categorrr',
+ 'post_submit_action' => 'create_another'
+ ]
+ );
+ $I->see('Transaction "Test" stored.');
+ }
+
+
+ public function storeAndFail(FunctionalTester $I)
+ {
+ $I->wantTo('store a transaction and fail');
+ $I->amOnPage('/transactions/create/withdrawal');
+ $I->submitForm(
+ '#store', [
+ 'reminder' => '',
+ 'description' => '',
+ 'account_id' => 1,
+ 'expense_account' => 'Zomaar',
+ 'amount' => 100,
+ 'date' => '2014-12-30',
+ 'budget_id' => 3,
+ 'category' => 'Categorrr',
+ 'post_submit_action' => 'store'
+ ]
+ );
+ $I->see('Could not store transaction: This field is mandatory.');
}
public function update(FunctionalTester $I)
@@ -123,5 +178,45 @@ class TransactionControllerCest
$I->see('Huur Portaal for January 2014!');
}
+ public function updateAndFail(FunctionalTester $I)
+ {
+ $I->wantTo('update a transaction and fail');
+ $I->amOnPage('/transaction/edit/3');
+ $I->see('Huur Portaal for January 2014');
+ $I->submitForm(
+ '#update', [
+ 'description' => '',
+ 'account_id' => 1,
+ 'expense_account' => 'Portaal',
+ 'amount' => 500,
+ 'date' => '2014-01-01',
+ 'budget_id' => 2,
+ 'category' => 'House',
+ 'post_submit_action' => 'update'
+ ]
+ );
+ $I->see('Could not update transaction: This field is mandatory.');
+ }
+
+ public function updateAndReturn(FunctionalTester $I)
+ {
+ $I->wantTo('update a transaction and return to the edit screen');
+ $I->amOnPage('/transaction/edit/3');
+ $I->see('Huur Portaal for January 2014');
+ $I->submitForm(
+ '#update', [
+ 'description' => 'Huur Portaal for January 2014!',
+ 'account_id' => 1,
+ 'expense_account' => 'Portaal',
+ 'amount' => 500,
+ 'date' => '2014-01-01',
+ 'budget_id' => 2,
+ 'category' => 'House',
+ 'post_submit_action' => 'return_to_edit'
+ ]
+ );
+ $I->see('Huur Portaal for January 2014!');
+ }
+
}
\ No newline at end of file