mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-23 09:26:29 -06:00
Updated code coverage.
This commit is contained in:
parent
4bb17019a4
commit
cac30f0b4c
@ -32,6 +32,7 @@ class FF3ServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Return the services bla bla.
|
||||
*
|
||||
* @CodeCoverageIgnore
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
|
@ -88,9 +88,6 @@ class Form
|
||||
/** @var MessageBag $errors */
|
||||
$errors = \Session::get('errors');
|
||||
|
||||
/** @var MessageBag $warnings */
|
||||
$warnings = \Session::get('warnings');
|
||||
|
||||
/** @var MessageBag $successes */
|
||||
$successes = \Session::get('successes');
|
||||
|
||||
@ -98,9 +95,6 @@ class Form
|
||||
case (!is_null($errors) && $errors->has($name)):
|
||||
$classes = 'form-group has-error has-feedback';
|
||||
break;
|
||||
case (!is_null($warnings) && $warnings->has($name)):
|
||||
$classes = 'form-group has-warning has-feedback';
|
||||
break;
|
||||
case (!is_null($successes) && $successes->has($name)):
|
||||
$classes = 'form-group has-success has-feedback';
|
||||
break;
|
||||
|
@ -193,6 +193,30 @@ class PiggyBankControllerCest
|
||||
'account_id' => 1, 'targetamount' => 1000]
|
||||
);
|
||||
$I->see('Piggy bank "Some new piggy bank" stored.');
|
||||
$I->seeRecord('piggy_banks', ['name' => 'Some new piggy bank']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function storeValidate(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('validate a new piggy bank');
|
||||
$I->amOnPage('/piggy_banks/create');
|
||||
$I->see('Create new piggy bank');
|
||||
$I->submitForm(
|
||||
'#store', ['name' => 'Some new piggy bank validated',
|
||||
'rep_every' => 0,
|
||||
'reminder_skip' => 0,
|
||||
'remind_me' => 0,
|
||||
'order' => 3,
|
||||
'post_submit_action' => 'validate_only',
|
||||
'account_id' => 1,
|
||||
'targetamount' => 1000]
|
||||
);
|
||||
$I->see('OK');
|
||||
$I->seeInSession('successes');
|
||||
$I->dontSeeRecord('piggy_banks', ['name' => 'Some new piggy bank validated']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,6 +117,33 @@ class RepeatedExpenseControllerCest
|
||||
$I->see('Piggy bank "TestRepeatedExpense" stored.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function storeValidate(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('validate a repeated expense');
|
||||
$I->amOnPage('/repeatedexpenses/create');
|
||||
$I->submitForm(
|
||||
'#store', [
|
||||
'name' => 'TestRepeatedExpenseXX',
|
||||
'account_id' => 1,
|
||||
'targetamount' => 1000,
|
||||
'targetdate' => Carbon::now()->format('Y-m-d'),
|
||||
'rep_length' => 'month',
|
||||
'rep_every' => 0,
|
||||
'rep_times' => 0,
|
||||
'remind_me' => 1,
|
||||
'reminder' => 'month',
|
||||
'post_submit_action' => 'validate_only',
|
||||
]
|
||||
);
|
||||
|
||||
$I->see('TestRepeatedExpenseXX');
|
||||
$I->see('OK');
|
||||
$I->seeInSession('successes');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
@ -192,6 +219,33 @@ class RepeatedExpenseControllerCest
|
||||
$I->see('Repeated expense "' . $repeatedExpense->name . '!" updated.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function updateValidate(FunctionalTester $I)
|
||||
{
|
||||
$repeatedExpense = PiggyBank::where('repeats', 1)->first();
|
||||
$I->wantTo('validate an updated repeated expense');
|
||||
$I->amOnPage('/repeatedexpenses/edit/' . $repeatedExpense->id);
|
||||
$I->submitForm(
|
||||
'#update', [
|
||||
'name' => $repeatedExpense->name . 'ABCD',
|
||||
'account_id' => 2,
|
||||
'targetamount' => 1000.00,
|
||||
'targetdate' => $repeatedExpense->targetdate->format('Y-m-d'),
|
||||
'rep_length' => 'month',
|
||||
'rep_every' => 0,
|
||||
'rep_times' => 0,
|
||||
'remind_me' => 1,
|
||||
'reminder' => 'month',
|
||||
'post_submit_action' => 'validate_only',
|
||||
]
|
||||
);
|
||||
$I->see($repeatedExpense->name . 'ABCD');
|
||||
$I->see('OK');
|
||||
$I->seeInSession('successes');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
|
@ -114,7 +114,7 @@ class TransactionControllerCest
|
||||
$I->wantTo('see a grouped transaction');
|
||||
$I->amOnPage('/transaction/show/' . $journal->id);
|
||||
$I->see($journal->description);
|
||||
$I->see('Money for '.$journal->description);
|
||||
$I->see('Money for ' . $journal->description);
|
||||
}
|
||||
|
||||
public function store(FunctionalTester $I)
|
||||
@ -137,6 +137,29 @@ class TransactionControllerCest
|
||||
$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)
|
||||
{
|
||||
$I->wantTo('store a transaction and fail');
|
||||
@ -199,6 +222,30 @@ 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();
|
||||
|
Loading…
Reference in New Issue
Block a user