mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 10:33:30 +00:00
Some refactoring.
This commit is contained in:
@@ -58,18 +58,18 @@ class Chart implements ChartInterface
|
|||||||
->where('transaction_journals.date', '<=', $end->format('Y-m-d'));
|
->where('transaction_journals.date', '<=', $end->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
'transactions', function (JoinClause $join) {
|
'transactions', function (JoinClause $join) {
|
||||||
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '>', 0);
|
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '>', 0);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->where('active', 1)
|
->where('active', 1)
|
||||||
->groupBy('bills.id')
|
->groupBy('bills.id')
|
||||||
->get(
|
->get(
|
||||||
['bills.id', 'bills.name', 'transaction_journals.description',
|
['bills.id', 'bills.name', 'transaction_journals.description',
|
||||||
'transaction_journals.id as journalId',
|
'transaction_journals.id as journalId',
|
||||||
\DB::Raw('SUM(`bills`.`amount_min` + `bills`.`amount_max`) / 2 as `averageAmount`'),
|
\DB::Raw('SUM(`bills`.`amount_min` + `bills`.`amount_max`) / 2 as `averageAmount`'),
|
||||||
'transactions.amount AS actualAmount']
|
'transactions.amount AS actualAmount']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -65,7 +65,7 @@ class Bill implements CUD, CommonDatabaseCalls, BillInterface
|
|||||||
/*
|
/*
|
||||||
* Jump to the start of the period.
|
* Jump to the start of the period.
|
||||||
*/
|
*/
|
||||||
$date = \DateKit::startOfPeriod($date, $data['repeat_freq']);
|
$date = \DateKit::startOfPeriod($date, $data['repeat_freq']);
|
||||||
$bill->date = $date;
|
$bill->date = $date;
|
||||||
$bill->skip = intval($data['skip']);
|
$bill->skip = intval($data['skip']);
|
||||||
|
|
||||||
@@ -193,9 +193,9 @@ class Bill implements CUD, CommonDatabaseCalls, BillInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Bill $bill
|
* @param \Bill $bill
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return \TransactionJournal|null
|
* @return \TransactionJournal|null
|
||||||
*/
|
*/
|
||||||
@@ -206,8 +206,8 @@ class Bill implements CUD, CommonDatabaseCalls, BillInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Bill $bill
|
* @param \Bill $bill
|
||||||
* @param \TransactionJournal $journal
|
* @param \TransactionJournal $journal
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@@ -238,6 +238,7 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method includes the time because otherwise, SQLite doesn't understand it.
|
* This method includes the time because otherwise, SQLite doesn't understand it.
|
||||||
|
*
|
||||||
* @param \Budget $budget
|
* @param \Budget $budget
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
*
|
*
|
||||||
@@ -369,6 +370,5 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
|||||||
return $budget->budgetLimits()->where('startdate', $date->format('Y-m-d 00:00:00'))->first();
|
return $budget->budgetLimits()->where('startdate', $date->format('Y-m-d 00:00:00'))->first();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -6,7 +6,6 @@ use FireflyIII\Database\CommonDatabaseCalls;
|
|||||||
use FireflyIII\Database\CUD;
|
use FireflyIII\Database\CUD;
|
||||||
use FireflyIII\Exception\FireflyException;
|
use FireflyIII\Exception\FireflyException;
|
||||||
use FireflyIII\Exception\NotImplementedException;
|
use FireflyIII\Exception\NotImplementedException;
|
||||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace FireflyIII\Database\PiggyBank;
|
namespace FireflyIII\Database\PiggyBank;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use FireflyIII\Database\SwitchUser;
|
use FireflyIII\Database\SwitchUser;
|
||||||
use FireflyIII\Exception\NotImplementedException;
|
use FireflyIII\Exception\NotImplementedException;
|
||||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||||
|
@@ -6,9 +6,6 @@ namespace FireflyIII\Database\PiggyBank;
|
|||||||
use FireflyIII\Collection\PiggyBankPart;
|
use FireflyIII\Collection\PiggyBankPart;
|
||||||
use FireflyIII\Database\CommonDatabaseCalls;
|
use FireflyIII\Database\CommonDatabaseCalls;
|
||||||
use FireflyIII\Database\CUD;
|
use FireflyIII\Database\CUD;
|
||||||
use FireflyIII\Database\SwitchUser;
|
|
||||||
use FireflyIII\Exception\NotImplementedException;
|
|
||||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -44,8 +44,8 @@ class TransactionJournal
|
|||||||
public function update(\TransactionJournal $journal)
|
public function update(\TransactionJournal $journal)
|
||||||
{
|
{
|
||||||
/** @var \FireflyIII\Database\Bill\Bill $repository */
|
/** @var \FireflyIII\Database\Bill\Bill $repository */
|
||||||
$repository = \App::make('FireflyIII\Database\Bill\Bill');
|
$repository = \App::make('FireflyIII\Database\Bill\Bill');
|
||||||
$set = $repository->get();
|
$set = $repository->get();
|
||||||
$journal->bill_id = null;
|
$journal->bill_id = null;
|
||||||
$journal->save();
|
$journal->save();
|
||||||
|
|
||||||
|
@@ -123,7 +123,7 @@ class Form
|
|||||||
$html .= \Form::input('text', $name, $value, $options);
|
$html .= \Form::input('text', $name, $value, $options);
|
||||||
break;
|
break;
|
||||||
case 'amount':
|
case 'amount':
|
||||||
$html .= '<div class="input-group"><div class="input-group-addon">'.getCurrencySymbol().'</div>';
|
$html .= '<div class="input-group"><div class="input-group-addon">' . getCurrencySymbol() . '</div>';
|
||||||
$html .= \Form::input('number', $name, $value, $options);
|
$html .= \Form::input('number', $name, $value, $options);
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
break;
|
break;
|
||||||
|
@@ -95,6 +95,29 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
return $one;
|
return $one;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort an array where all 'amount' keys are positive floats.
|
||||||
|
*
|
||||||
|
* @param array $array
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function sortArray(array $array)
|
||||||
|
{
|
||||||
|
uasort(
|
||||||
|
$array, function ($left, $right) {
|
||||||
|
if ($left['amount'] == $right['amount']) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($left['amount'] < $right['amount']) ? 1 : -1;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $array;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort an array where all 'amount' keys are negative floats.
|
* Sort an array where all 'amount' keys are negative floats.
|
||||||
*
|
*
|
||||||
@@ -116,25 +139,4 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
|
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sort an array where all 'amount' keys are positive floats.
|
|
||||||
*
|
|
||||||
* @param array $array
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function sortArray(array $array) {
|
|
||||||
uasort(
|
|
||||||
$array, function ($left, $right) {
|
|
||||||
if ($left['amount'] == $right['amount']) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($left['amount'] < $right['amount']) ? 1 : -1;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return $array;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -43,15 +43,6 @@ interface ReportHelperInterface
|
|||||||
*/
|
*/
|
||||||
public function mergeArrays(array $one, array $two);
|
public function mergeArrays(array $one, array $two);
|
||||||
|
|
||||||
/**
|
|
||||||
* Sort an array where all 'amount' keys are negative floats.
|
|
||||||
*
|
|
||||||
* @param array $array
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function sortNegativeArray(array $array);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort an array where all 'amount' keys are positive floats.
|
* Sort an array where all 'amount' keys are positive floats.
|
||||||
*
|
*
|
||||||
@@ -61,4 +52,13 @@ interface ReportHelperInterface
|
|||||||
*/
|
*/
|
||||||
public function sortArray(array $array);
|
public function sortArray(array $array);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort an array where all 'amount' keys are negative floats.
|
||||||
|
*
|
||||||
|
* @param array $array
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function sortNegativeArray(array $array);
|
||||||
|
|
||||||
}
|
}
|
@@ -44,8 +44,8 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
* and are balanced by a transfer to make up for it.
|
* and are balanced by a transfer to make up for it.
|
||||||
*
|
*
|
||||||
* @param \Account $account
|
* @param \Account $account
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
@@ -97,8 +97,8 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
* and are balanced by a transfer to make up for it.
|
* and are balanced by a transfer to make up for it.
|
||||||
*
|
*
|
||||||
* @param \Account $account
|
* @param \Account $account
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
|
@@ -47,8 +47,8 @@ interface ReportQueryInterface
|
|||||||
* and are balanced by a transfer to make up for it.
|
* and are balanced by a transfer to make up for it.
|
||||||
*
|
*
|
||||||
* @param \Account $account
|
* @param \Account $account
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
@@ -59,8 +59,8 @@ interface ReportQueryInterface
|
|||||||
* and are balanced by a transfer to make up for it.
|
* and are balanced by a transfer to make up for it.
|
||||||
*
|
*
|
||||||
* @param \Account $account
|
* @param \Account $account
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
|
@@ -24,6 +24,7 @@ class Preferences implements PreferencesInterface
|
|||||||
if (!is_null($pref)) {
|
if (!is_null($pref)) {
|
||||||
return $pref;
|
return $pref;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->set($name, $default);
|
return $this->set($name, $default);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace FireflyIII\Shared\Toolkit;
|
namespace FireflyIII\Shared\Toolkit;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exception\FireflyException;
|
use FireflyIII\Exception\FireflyException;
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ class Steam
|
|||||||
*/
|
*/
|
||||||
public function balance(\Account $account, Carbon $date = null)
|
public function balance(\Account $account, Carbon $date = null)
|
||||||
{
|
{
|
||||||
\Log::debug('Now in Steam::balance() for account #' . $account->id.' ('.$account->name.')');
|
\Log::debug('Now in Steam::balance() for account #' . $account->id . ' (' . $account->name . ')');
|
||||||
if (is_null($date)) {
|
if (is_null($date)) {
|
||||||
$key = 'account.' . $account->id . '.latestBalance';
|
$key = 'account.' . $account->id . '.latestBalance';
|
||||||
} else {
|
} else {
|
||||||
@@ -33,7 +33,7 @@ class Steam
|
|||||||
// TODO find a way to reliably remove cache entries for accounts.
|
// TODO find a way to reliably remove cache entries for accounts.
|
||||||
#return \Cache::get($key);
|
#return \Cache::get($key);
|
||||||
}
|
}
|
||||||
$date = is_null($date) ? Carbon::now() : $date;
|
$date = is_null($date) ? Carbon::now() : $date;
|
||||||
\Log::debug('Now reached the moment we fire the query.');
|
\Log::debug('Now reached the moment we fire the query.');
|
||||||
$balance = floatval(
|
$balance = floatval(
|
||||||
$account->transactions()->leftJoin(
|
$account->transactions()->leftJoin(
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
<i class="fa fa-repeat"></i> Transactions ({{$result['transactions']->count()}})
|
<i class="fa fa-repeat"></i> Transactions ({{$result['transactions']->count()}})
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
@include('...lists.old.journals-small-noaccount',['transactions' => $result['transactions']])
|
@include('list.journals-small',['journals' => $result['transactions']])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -68,6 +68,19 @@ class AccountControllerCest
|
|||||||
$I->see('Edit asset account "Delete me"');
|
$I->see('Edit asset account "Delete me"');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function failUpdate(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('update an asset account and fail');
|
||||||
|
$I->amOnPage('/accounts/edit/3');
|
||||||
|
$I->see('Edit asset account "Delete me"');
|
||||||
|
$I->submitForm('#update', ['name' => '', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'update']);
|
||||||
|
$I->seeRecord('accounts', ['name' => 'Delete me']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -103,21 +116,6 @@ class AccountControllerCest
|
|||||||
resetToClean::clean();
|
resetToClean::clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function storeValidateOnly(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->amOnPage('/accounts/create/asset');
|
|
||||||
$I->wantTo('validate a new asset account');
|
|
||||||
$I->see('Create a new asset account');
|
|
||||||
$I->submitForm(
|
|
||||||
'#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']
|
|
||||||
);
|
|
||||||
$I->dontSeeRecord('accounts', ['name' => 'New through tests.']);
|
|
||||||
resetToClean::clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -146,6 +144,21 @@ class AccountControllerCest
|
|||||||
resetToClean::clean();
|
resetToClean::clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function storeValidateOnly(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->amOnPage('/accounts/create/asset');
|
||||||
|
$I->wantTo('validate a new asset account');
|
||||||
|
$I->see('Create a new asset account');
|
||||||
|
$I->submitForm(
|
||||||
|
'#store', ['name' => 'New through tests.', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']
|
||||||
|
);
|
||||||
|
$I->dontSeeRecord('accounts', ['name' => 'New through tests.']);
|
||||||
|
resetToClean::clean();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -160,34 +173,6 @@ class AccountControllerCest
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function failUpdate(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('update an asset account and fail');
|
|
||||||
$I->amOnPage('/accounts/edit/3');
|
|
||||||
$I->see('Edit asset account "Delete me"');
|
|
||||||
$I->submitForm('#update', ['name' => '', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'update']);
|
|
||||||
$I->seeRecord('accounts', ['name' => 'Delete me']);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function validateUpdateOnly(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('update an asset account and validate only');
|
|
||||||
$I->amOnPage('/accounts/edit/2');
|
|
||||||
$I->see('Edit asset account "Savings account"');
|
|
||||||
$I->submitForm(
|
|
||||||
'#update', ['name' => 'Savings accountXX', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']
|
|
||||||
);
|
|
||||||
$I->dontSeeRecord('accounts', ['name' => 'Savings accountXX']);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -204,4 +189,19 @@ class AccountControllerCest
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function validateUpdateOnly(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('update an asset account and validate only');
|
||||||
|
$I->amOnPage('/accounts/edit/2');
|
||||||
|
$I->see('Edit asset account "Savings account"');
|
||||||
|
$I->submitForm(
|
||||||
|
'#update', ['name' => 'Savings accountXX', 'what' => 'asset', 'account_role' => 'defaultExpense', 'post_submit_action' => 'validate_only']
|
||||||
|
);
|
||||||
|
$I->dontSeeRecord('accounts', ['name' => 'Savings accountXX']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -217,28 +217,6 @@ class BillControllerCest
|
|||||||
$I->see('Bill "Some bill" updated.');
|
$I->see('Bill "Some bill" updated.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function updateReturn(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('update a bill and return to edit it');
|
|
||||||
$I->amOnPage('/bills/edit/1');
|
|
||||||
$I->submitForm(
|
|
||||||
'#update', [
|
|
||||||
'name' => 'Some bill',
|
|
||||||
'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('Bill "Some bill" updated.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -260,4 +238,26 @@ class BillControllerCest
|
|||||||
$I->see('Could not update bill');
|
$I->see('Could not update bill');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function updateReturn(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('update a bill and return to edit it');
|
||||||
|
$I->amOnPage('/bills/edit/1');
|
||||||
|
$I->submitForm(
|
||||||
|
'#update', [
|
||||||
|
'name' => 'Some bill',
|
||||||
|
'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('Bill "Some bill" updated.');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -82,6 +82,19 @@ class BudgetControllerCest
|
|||||||
$I->see('Edit budget "Delete me"');
|
$I->see('Edit budget "Delete me"');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function failUpdate(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('update a budget and fail');
|
||||||
|
$I->amOnPage('/budgets/edit/3');
|
||||||
|
$I->see('Edit budget "Delete me"');
|
||||||
|
$I->submitForm('#update', ['name' => '', 'post_submit_action' => 'update']);
|
||||||
|
$I->seeRecord('budgets', ['name' => 'Delete me']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -138,18 +151,6 @@ class BudgetControllerCest
|
|||||||
resetToClean::clean();
|
resetToClean::clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function storeValidateOnly(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->amOnPage('/budgets/create');
|
|
||||||
$I->wantTo('validate a new budget');
|
|
||||||
$I->see('Create a new budget');
|
|
||||||
$I->submitForm('#store', ['name' => 'New budget.', 'post_submit_action' => 'validate_only']);
|
|
||||||
$I->dontSeeRecord('budgets', ['name' => 'New budget.']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -170,10 +171,21 @@ class BudgetControllerCest
|
|||||||
$I->amOnPage('/budgets/create');
|
$I->amOnPage('/budgets/create');
|
||||||
$I->wantTo('make storing a new budget fail.');
|
$I->wantTo('make storing a new budget fail.');
|
||||||
$I->see('Create a new budget');
|
$I->see('Create a new budget');
|
||||||
$I->submitForm('#store', ['name' => null, 'post_submit_action' => 'store']);
|
$I->submitForm('#store', ['name' => null, 'post_submit_action' => 'store']);
|
||||||
$I->dontSeeRecord('budgets', ['name' => 'New budget.']);
|
$I->dontSeeRecord('budgets', ['name' => 'New budget.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function storeValidateOnly(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->amOnPage('/budgets/create');
|
||||||
|
$I->wantTo('validate a new budget');
|
||||||
|
$I->see('Create a new budget');
|
||||||
|
$I->submitForm('#store', ['name' => 'New budget.', 'post_submit_action' => 'validate_only']);
|
||||||
|
$I->dontSeeRecord('budgets', ['name' => 'New budget.']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
@@ -192,16 +204,28 @@ class BudgetControllerCest
|
|||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
public function failUpdate(FunctionalTester $I)
|
public function updateAndReturn(FunctionalTester $I)
|
||||||
{
|
{
|
||||||
$I->wantTo('update a budget and fail');
|
$I->wantTo('update a budget and return to form');
|
||||||
$I->amOnPage('/budgets/edit/3');
|
$I->amOnPage('/budgets/edit/3');
|
||||||
$I->see('Edit budget "Delete me"');
|
$I->see('Edit budget "Delete me"');
|
||||||
$I->submitForm('#update', ['name' => '', 'post_submit_action' => 'update']);
|
$I->submitForm(
|
||||||
$I->seeRecord('budgets', ['name' => 'Delete me']);
|
'#update', ['name' => 'Savings accountXX', 'post_submit_action' => 'return_to_edit']
|
||||||
|
);
|
||||||
|
$I->seeRecord('budgets', ['name' => 'Savings accountXX']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function updateIncome(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->amOnPage('/budgets/income');
|
||||||
|
$I->wantTo('update my monthly income');
|
||||||
|
$I->see('Update (expected) income for ');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -217,29 +241,4 @@ class BudgetControllerCest
|
|||||||
$I->seeRecord('budgets', ['name' => 'Delete me']);
|
$I->seeRecord('budgets', ['name' => 'Delete me']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function updateAndReturn(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('update a budget and return to form');
|
|
||||||
$I->amOnPage('/budgets/edit/3');
|
|
||||||
$I->see('Edit budget "Delete me"');
|
|
||||||
$I->submitForm(
|
|
||||||
'#update', ['name' => 'Savings accountXX', 'post_submit_action' => 'return_to_edit']
|
|
||||||
);
|
|
||||||
$I->seeRecord('budgets', ['name' => 'Savings accountXX']);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function updateIncome(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->amOnPage('/budgets/income');
|
|
||||||
$I->wantTo('update my monthly income');
|
|
||||||
$I->see('Update (expected) income for ');
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -65,6 +65,19 @@ class CategoryControllerCest
|
|||||||
$I->see('Edit category "Delete me"');
|
$I->see('Edit category "Delete me"');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function failUpdate(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('update a category and fail');
|
||||||
|
$I->amOnPage('/categories/edit/4');
|
||||||
|
$I->see('Edit category "Delete me"');
|
||||||
|
$I->submitForm('#update', ['name' => '', 'post_submit_action' => 'update']);
|
||||||
|
$I->seeRecord('categories', ['name' => 'Delete me']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -97,19 +110,6 @@ class CategoryControllerCest
|
|||||||
resetToClean::clean();
|
resetToClean::clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function storeValidateOnly(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->amOnPage('/categories/create');
|
|
||||||
$I->wantTo('validate a new category');
|
|
||||||
$I->see('Create a new category');
|
|
||||||
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'validate_only']);
|
|
||||||
$I->dontSeeRecord('categories', ['name' => 'New category.']);
|
|
||||||
resetToClean::clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -131,10 +131,24 @@ class CategoryControllerCest
|
|||||||
$I->amOnPage('/categories/create');
|
$I->amOnPage('/categories/create');
|
||||||
$I->wantTo('make storing a new category fail.');
|
$I->wantTo('make storing a new category fail.');
|
||||||
$I->see('Create a new category');
|
$I->see('Create a new category');
|
||||||
$I->submitForm('#store', ['name' => null, 'post_submit_action' => 'validate_only']);
|
$I->submitForm('#store', ['name' => null, 'post_submit_action' => 'validate_only']);
|
||||||
$I->dontSeeRecord('categories', ['name' => 'New category.']);
|
$I->dontSeeRecord('categories', ['name' => 'New category.']);
|
||||||
resetToClean::clean();
|
resetToClean::clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function storeValidateOnly(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->amOnPage('/categories/create');
|
||||||
|
$I->wantTo('validate a new category');
|
||||||
|
$I->see('Create a new category');
|
||||||
|
$I->submitForm('#store', ['name' => 'New category.', 'post_submit_action' => 'validate_only']);
|
||||||
|
$I->dontSeeRecord('categories', ['name' => 'New category.']);
|
||||||
|
resetToClean::clean();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -152,13 +166,15 @@ class CategoryControllerCest
|
|||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
public function failUpdate(FunctionalTester $I)
|
public function updateAndReturn(FunctionalTester $I)
|
||||||
{
|
{
|
||||||
$I->wantTo('update a category and fail');
|
$I->wantTo('update a category and return to form');
|
||||||
$I->amOnPage('/categories/edit/4');
|
$I->amOnPage('/categories/edit/4');
|
||||||
$I->see('Edit category "Delete me"');
|
$I->see('Edit category "Delete me"');
|
||||||
$I->submitForm('#update', ['name' => '', 'post_submit_action' => 'update']);
|
$I->submitForm(
|
||||||
$I->seeRecord('categories', ['name' => 'Delete me']);
|
'#update', ['name' => 'Savings accountXX', 'post_submit_action' => 'return_to_edit']
|
||||||
|
);
|
||||||
|
$I->seeRecord('categories', ['name' => 'Savings accountXX']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,19 +194,4 @@ class CategoryControllerCest
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function updateAndReturn(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('update a category and return to form');
|
|
||||||
$I->amOnPage('/categories/edit/4');
|
|
||||||
$I->see('Edit category "Delete me"');
|
|
||||||
$I->submitForm(
|
|
||||||
'#update', ['name' => 'Savings accountXX', 'post_submit_action' => 'return_to_edit']
|
|
||||||
);
|
|
||||||
$I->seeRecord('categories', ['name' => 'Savings accountXX']);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@@ -35,6 +35,16 @@ class CurrencyControllerCest
|
|||||||
$I->see('Create a new currency');
|
$I->see('Create a new currency');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function defaultCurrency(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('make US Dollar the default currency');
|
||||||
|
$I->amOnPage('/currency/default/2');
|
||||||
|
$I->see('US Dollar is now the default currency.');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -57,16 +67,6 @@ class CurrencyControllerCest
|
|||||||
$I->see('Currency "Hungarian forint" deleted');
|
$I->see('Currency "Hungarian forint" deleted');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function defaultCurrency(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('make US Dollar the default currency');
|
|
||||||
$I->amOnPage('/currency/default/2');
|
|
||||||
$I->see('US Dollar is now the default currency.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -87,6 +87,19 @@ class CurrencyControllerCest
|
|||||||
$I->see('Edit currency "US Dollar"');
|
$I->see('Edit currency "US Dollar"');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function failUpdate(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('update a currency and fail');
|
||||||
|
$I->amOnPage('/currency/edit/2');
|
||||||
|
$I->see('Edit currency "US Dollar"');
|
||||||
|
$I->submitForm('#update', ['name' => 'Failed update', 'code' => '123', 'post_submit_action' => 'update']);
|
||||||
|
$I->dontSeeRecord('transaction_currencies', ['name' => 'Failed update']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -162,13 +175,15 @@ class CurrencyControllerCest
|
|||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
public function failUpdate(FunctionalTester $I)
|
public function updateAndReturn(FunctionalTester $I)
|
||||||
{
|
{
|
||||||
$I->wantTo('update a currency and fail');
|
$I->wantTo('update a currency and return to form');
|
||||||
$I->amOnPage('/currency/edit/2');
|
$I->amOnPage('/currency/edit/2');
|
||||||
$I->see('Edit currency "US Dollar"');
|
$I->see('Edit currency "US Dollar"');
|
||||||
$I->submitForm('#update', ['name' => 'Failed update', 'code' => '123', 'post_submit_action' => 'update']);
|
$I->submitForm(
|
||||||
$I->dontSeeRecord('transaction_currencies', ['name' => 'Failed update']);
|
'#update', ['name' => 'US DollarXXX', 'symbol' => '$', 'code' => 'USD', 'post_submit_action' => 'return_to_edit']
|
||||||
|
);
|
||||||
|
$I->seeRecord('transaction_currencies', ['name' => 'US DollarXXX']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,19 +200,4 @@ class CurrencyControllerCest
|
|||||||
$I->seeRecord('transaction_currencies', ['name' => 'US Dollar']);
|
$I->seeRecord('transaction_currencies', ['name' => 'US Dollar']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function updateAndReturn(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('update a currency and return to form');
|
|
||||||
$I->amOnPage('/currency/edit/2');
|
|
||||||
$I->see('Edit currency "US Dollar"');
|
|
||||||
$I->submitForm(
|
|
||||||
'#update', ['name' => 'US DollarXXX', 'symbol' => '$', 'code' => 'USD', 'post_submit_action' => 'return_to_edit']
|
|
||||||
);
|
|
||||||
$I->seeRecord('transaction_currencies', ['name' => 'US DollarXXX']);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -26,20 +26,20 @@ class GoogleChartControllerCest
|
|||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
public function accountBalanceChart(FunctionalTester $I)
|
public function accountAllBalanceChart(FunctionalTester $I)
|
||||||
{
|
{
|
||||||
$I->wantTo('see the session balance chart of an account.');
|
$I->wantTo('see the complete balance chart of an account.');
|
||||||
$I->amOnPage('chart/account/1/session');
|
$I->amOnPage('chart/account/1/all');
|
||||||
$I->seeResponseCodeIs(200);
|
$I->seeResponseCodeIs(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
public function accountAllBalanceChart(FunctionalTester $I)
|
public function accountBalanceChart(FunctionalTester $I)
|
||||||
{
|
{
|
||||||
$I->wantTo('see the complete balance chart of an account.');
|
$I->wantTo('see the session balance chart of an account.');
|
||||||
$I->amOnPage('chart/account/1/all');
|
$I->amOnPage('chart/account/1/session');
|
||||||
$I->seeResponseCodeIs(200);
|
$I->seeResponseCodeIs(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,6 +73,26 @@ class GoogleChartControllerCest
|
|||||||
$I->seeResponseCodeIs(200);
|
$I->seeResponseCodeIs(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function billOverview(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('see the chart for the history of a bill');
|
||||||
|
$I->amOnPage('/chart/bills/1');
|
||||||
|
$I->seeResponseCodeIs(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function billsOverview(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('see the chart for which bills I have yet to pay');
|
||||||
|
$I->amOnPage('/chart/home/bills');
|
||||||
|
$I->seeResponseCodeIs(200);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -125,26 +145,6 @@ class GoogleChartControllerCest
|
|||||||
$I->see('Invalid year');
|
$I->see('Invalid year');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function piggyBankHistory(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('see the chart for the history of a piggy bank');
|
|
||||||
$I->amOnPage('/chart/piggy_history/1');
|
|
||||||
$I->seeResponseCodeIs(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function billOverview(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('see the chart for the history of a bill');
|
|
||||||
$I->amOnPage('/chart/bills/1');
|
|
||||||
$I->seeResponseCodeIs(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -158,10 +158,10 @@ class GoogleChartControllerCest
|
|||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
public function billsOverview(FunctionalTester $I)
|
public function piggyBankHistory(FunctionalTester $I)
|
||||||
{
|
{
|
||||||
$I->wantTo('see the chart for which bills I have yet to pay');
|
$I->wantTo('see the chart for the history of a piggy bank');
|
||||||
$I->amOnPage('/chart/home/bills');
|
$I->amOnPage('/chart/piggy_history/1');
|
||||||
$I->seeResponseCodeIs(200);
|
$I->seeResponseCodeIs(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -211,7 +211,7 @@ class PiggyBankControllerCest
|
|||||||
'remind_me' => 0,
|
'remind_me' => 0,
|
||||||
'order' => 3,
|
'order' => 3,
|
||||||
'account_id' => 1,
|
'account_id' => 1,
|
||||||
'targetamount' => 1000]
|
'targetamount' => 1000]
|
||||||
);
|
);
|
||||||
$I->see('Piggy bank "Some new piggy bank" stored.');
|
$I->see('Piggy bank "Some new piggy bank" stored.');
|
||||||
}
|
}
|
||||||
@@ -225,14 +225,14 @@ class PiggyBankControllerCest
|
|||||||
$I->amOnPage('/piggy_banks/create');
|
$I->amOnPage('/piggy_banks/create');
|
||||||
$I->see('Create new piggy bank');
|
$I->see('Create new piggy bank');
|
||||||
$I->submitForm(
|
$I->submitForm(
|
||||||
'#store', ['name' => null,
|
'#store', ['name' => null,
|
||||||
'rep_every' => 0,
|
'rep_every' => 0,
|
||||||
'reminder_skip' => 0,
|
'reminder_skip' => 0,
|
||||||
'remind_me' => 0,
|
'remind_me' => 0,
|
||||||
'order' => 3,
|
'order' => 3,
|
||||||
'account_id' => 1,
|
'account_id' => 1,
|
||||||
'post_submit_action' => 'store',
|
'post_submit_action' => 'store',
|
||||||
'targetamount' => 1000]
|
'targetamount' => 1000]
|
||||||
);
|
);
|
||||||
$I->see('The name field is required.');
|
$I->see('The name field is required.');
|
||||||
}
|
}
|
||||||
@@ -281,29 +281,6 @@ class PiggyBankControllerCest
|
|||||||
$I->see('Piggy bank "Updated camera" updated.');
|
$I->see('Piggy bank "Updated camera" updated.');
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function updateValidateOnly(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('validate a piggy bank');
|
|
||||||
$I->amOnPage('/piggy_banks/edit/1');
|
|
||||||
$I->see('Edit piggy bank "New camera"');
|
|
||||||
$I->submitForm(
|
|
||||||
'#update', [
|
|
||||||
'name' => 'Updated camera',
|
|
||||||
'account_id' => 2,
|
|
||||||
'targetamount' => 2000,
|
|
||||||
'targetdate' => '',
|
|
||||||
'reminder' => 'week',
|
|
||||||
'post_submit_action' => 'validate_only',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$I->see('Updated camera');
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -329,4 +306,27 @@ class PiggyBankControllerCest
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function updateValidateOnly(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('validate a piggy bank');
|
||||||
|
$I->amOnPage('/piggy_banks/edit/1');
|
||||||
|
$I->see('Edit piggy bank "New camera"');
|
||||||
|
$I->submitForm(
|
||||||
|
'#update', [
|
||||||
|
'name' => 'Updated camera',
|
||||||
|
'account_id' => 2,
|
||||||
|
'targetamount' => 2000,
|
||||||
|
'targetdate' => '',
|
||||||
|
'reminder' => 'week',
|
||||||
|
'post_submit_action' => 'validate_only',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$I->see('Updated camera');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -85,6 +85,26 @@ class ProfileControllerCest
|
|||||||
$I->see('Invalid current password!');
|
$I->see('Invalid current password!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function postChangePasswordNoMatch(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('submit a new password but make a mistake in filling it in twice.');
|
||||||
|
$I->amOnPage('/profile/change-password');
|
||||||
|
$I->see('thegrumpydictator@gmail.com');
|
||||||
|
$I->see('Change your password');
|
||||||
|
|
||||||
|
$I->submitForm(
|
||||||
|
'#change-password', [
|
||||||
|
'old' => 'james',
|
||||||
|
'new1' => 'blabla',
|
||||||
|
'new2' => 'bla'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$I->see('New passwords do not match!');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -126,25 +146,5 @@ class ProfileControllerCest
|
|||||||
$I->see('The idea is to change your password.');
|
$I->see('The idea is to change your password.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function postChangePasswordNoMatch(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('submit a new password but make a mistake in filling it in twice.');
|
|
||||||
$I->amOnPage('/profile/change-password');
|
|
||||||
$I->see('thegrumpydictator@gmail.com');
|
|
||||||
$I->see('Change your password');
|
|
||||||
|
|
||||||
$I->submitForm(
|
|
||||||
'#change-password', [
|
|
||||||
'old' => 'james',
|
|
||||||
'new1' => 'blabla',
|
|
||||||
'new2' => 'bla'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$I->see('New passwords do not match!');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@@ -34,6 +34,16 @@ class ReminderControllerCest
|
|||||||
$I->see('Money for Weekly reminder for clothes');
|
$I->see('Money for Weekly reminder for clothes');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
*/
|
||||||
|
public function actOnInvalid(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('act on an invalid reminder');
|
||||||
|
$I->amOnPage('/reminders/2/act');
|
||||||
|
$I->see('This reminder has an invalid class connected to it.');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* @param FunctionalTester $I
|
||||||
*/
|
*/
|
||||||
@@ -65,14 +75,4 @@ class ReminderControllerCest
|
|||||||
$I->see('your piggy bank labelled "Weekly reminder for clothes"');
|
$I->see('your piggy bank labelled "Weekly reminder for clothes"');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FunctionalTester $I
|
|
||||||
*/
|
|
||||||
public function actOnInvalid(FunctionalTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('act on an invalid reminder');
|
|
||||||
$I->amOnPage('/reminders/2/act');
|
|
||||||
$I->see('This reminder has an invalid class connected to it.');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@@ -109,7 +109,6 @@ class RepeatedExpenseControllerCest
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// $I->seeInDatabase('piggy_banks', ['name' => 'TestRepeatedExpense']);
|
|
||||||
$I->see('Piggy bank "TestRepeatedExpense" stored.');
|
$I->see('Piggy bank "TestRepeatedExpense" stored.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user