Tests for the recurring transaction controller.

This commit is contained in:
James Cole 2014-12-25 08:00:09 +01:00
parent ce27e97b92
commit 230bd6e40a
3 changed files with 140 additions and 3 deletions

View File

@ -195,7 +195,7 @@ class RecurringController extends BaseController
}
// go back to update screen.
return Redirect::route('piggy_banks.edit', $recurringTransaction->id)->withInput(['post_submit_action' => 'return_to_edit']);
return Redirect::route('recurring.edit', $recurringTransaction->id)->withInput(['post_submit_action' => 'return_to_edit']);
}
}

View File

@ -210,7 +210,8 @@ class PiggyBankControllerCest
'post_submit_action' => 'create_another',
'remind_me' => 0,
'order' => 3,
'account_id' => 1, 'targetamount' => 1000]
'account_id' => 1,
'targetamount' => 1000]
);
$I->see('Piggy bank "Some new piggy bank" stored.');
}
@ -229,7 +230,9 @@ class PiggyBankControllerCest
'reminder_skip' => 0,
'remind_me' => 0,
'order' => 3,
'account_id' => 1, 'targetamount' => 1000]
'account_id' => 1,
'post_submit_action' => 'store',
'targetamount' => 1000]
);
$I->see('Name is too short');
}

View File

@ -100,6 +100,7 @@ class RecurringControllerCest
{
$I->wantTo('show a recurring transaction');
$I->amOnPage('/recurring/show/1');
$I->see('Huur');
}
/**
@ -109,6 +110,84 @@ class RecurringControllerCest
{
$I->wantTo('store a recurring transaction');
$I->amOnPage('/recurring/create');
$I->submitForm(
'#store', [
'name' => 'Some recurring',
'match' => 'one,two',
'amount_min' => 10,
'amount_max' => 20,
'post_submit_action' => 'store',
'date' => date('Y-m-d'),
'repeat_freq' => 'monthly',
'skip' => 0
]
);
$I->see('Recurring transaction "Some recurring" stored.');
}
/**
* @param FunctionalTester $I
*/
public function storeFail(FunctionalTester $I)
{
$I->wantTo('store a recurring transaction and fail');
$I->amOnPage('/recurring/create');
$I->submitForm(
'#store', [
'name' => 'Some recurring',
'match' => '',
'amount_min' => 10,
'amount_max' => 20,
'date' => date('Y-m-d'),
'repeat_freq' => 'monthly',
'skip' => 0
]
);
$I->dontSeeInDatabase('recurring_transactions', ['name' => 'Some recurring']);
$I->see('Could not store recurring transaction');
}
public function storeRecreate(FunctionalTester $I)
{
$I->wantTo('validate a recurring transaction and create another one');
$I->amOnPage('/recurring/create');
$I->submitForm(
'#store', [
'name' => 'Some recurring',
'match' => 'one,two',
'amount_min' => 10,
'amount_max' => 20,
'post_submit_action' => 'create_another',
'date' => date('Y-m-d'),
'repeat_freq' => 'monthly',
'skip' => 0,
]
);
$I->see('Recurring transaction "Some recurring" stored.');
}
/**
* @param FunctionalTester $I
*/
public function storeValidate(FunctionalTester $I)
{
$I->wantTo('validate a recurring transaction');
$I->amOnPage('/recurring/create');
$I->submitForm(
'#store', [
'name' => 'Some recurring',
'match' => 'one,two',
'amount_min' => 10,
'amount_max' => 20,
'post_submit_action' => 'validate_only',
'date' => date('Y-m-d'),
'repeat_freq' => 'monthly',
'skip' => 0,
]
);
$I->see('form-group has-success has-feedback');
}
/**
@ -118,6 +197,61 @@ class RecurringControllerCest
{
$I->wantTo('update a recurring transaction');
$I->amOnPage('/recurring/edit/1');
$I->submitForm(
'#update', [
'name' => 'Some recurring',
'match' => 'bla,bla',
'amount_min' => 10,
'amount_max' => 20,
'date' => date('Y-m-d'),
'repeat_freq' => 'monthly',
'skip' => 0
]
);
$I->see('Recurring transaction "Some recurring" updated.');
}
/**
* @param FunctionalTester $I
*/
public function updateReturn(FunctionalTester $I)
{
$I->wantTo('update a recurring transaction and return to edit it');
$I->amOnPage('/recurring/edit/1');
$I->submitForm(
'#update', [
'name' => 'Some recurring',
'match' => 'bla,bla',
'amount_min' => 10,
'amount_max' => 20,
'post_submit_action' => 'return_to_edit',
'date' => date('Y-m-d'),
'repeat_freq' => 'monthly',
'skip' => 0
]
);
$I->see('Recurring transaction "Some recurring" updated.');
}
/**
* @param FunctionalTester $I
*/
public function updateFail(FunctionalTester $I)
{
$I->wantTo('update a recurring transaction and fail');
$I->amOnPage('/recurring/edit/1');
$I->submitForm(
'#update', [
'name' => 'Some recurring',
'match' => '',
'amount_min' => 10,
'amount_max' => 20,
'date' => date('Y-m-d'),
'repeat_freq' => 'monthly',
'skip' => 0
]
);
$I->see('Could not update recurring transaction');
}
}