mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 02:26:58 +00:00
Some refactoring.
This commit is contained in:
@@ -238,6 +238,7 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
|
||||
/**
|
||||
* This method includes the time because otherwise, SQLite doesn't understand it.
|
||||
*
|
||||
* @param \Budget $budget
|
||||
* @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();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@@ -6,7 +6,6 @@ use FireflyIII\Database\CommonDatabaseCalls;
|
||||
use FireflyIII\Database\CUD;
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace FireflyIII\Database\PiggyBank;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Database\SwitchUser;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
@@ -6,9 +6,6 @@ namespace FireflyIII\Database\PiggyBank;
|
||||
use FireflyIII\Collection\PiggyBankPart;
|
||||
use FireflyIII\Database\CommonDatabaseCalls;
|
||||
use FireflyIII\Database\CUD;
|
||||
use FireflyIII\Database\SwitchUser;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
|
@@ -123,7 +123,7 @@ class Form
|
||||
$html .= \Form::input('text', $name, $value, $options);
|
||||
break;
|
||||
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 .= '</div>';
|
||||
break;
|
||||
|
@@ -95,6 +95,29 @@ class ReportHelper implements ReportHelperInterface
|
||||
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.
|
||||
*
|
||||
@@ -116,25 +139,4 @@ class ReportHelper implements ReportHelperInterface
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@@ -61,4 +52,13 @@ interface ReportHelperInterface
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
@@ -24,6 +24,7 @@ class Preferences implements PreferencesInterface
|
||||
if (!is_null($pref)) {
|
||||
return $pref;
|
||||
}
|
||||
|
||||
return $this->set($name, $default);
|
||||
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Shared\Toolkit;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
|
||||
|
@@ -23,7 +23,7 @@ class Steam
|
||||
*/
|
||||
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)) {
|
||||
$key = 'account.' . $account->id . '.latestBalance';
|
||||
} else {
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<i class="fa fa-repeat"></i> Transactions ({{$result['transactions']->count()}})
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
@include('...lists.old.journals-small-noaccount',['transactions' => $result['transactions']])
|
||||
@include('list.journals-small',['journals' => $result['transactions']])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -68,6 +68,19 @@ class AccountControllerCest
|
||||
$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
|
||||
*/
|
||||
@@ -103,21 +116,6 @@ class AccountControllerCest
|
||||
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
|
||||
*/
|
||||
@@ -146,6 +144,21 @@ class AccountControllerCest
|
||||
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
|
||||
*/
|
||||
@@ -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
|
||||
*/
|
||||
@@ -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,6 +217,27 @@ class BillControllerCest
|
||||
$I->see('Bill "Some bill" updated.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function updateFail(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('update a bill and fail');
|
||||
$I->amOnPage('/bills/edit/1');
|
||||
$I->submitForm(
|
||||
'#update', [
|
||||
'name' => 'Some bill',
|
||||
'match' => '',
|
||||
'amount_min' => 10,
|
||||
'amount_max' => 20,
|
||||
'date' => date('Y-m-d'),
|
||||
'repeat_freq' => 'monthly',
|
||||
'skip' => 0
|
||||
]
|
||||
);
|
||||
$I->see('Could not update bill');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
@@ -239,25 +260,4 @@ class BillControllerCest
|
||||
$I->see('Bill "Some bill" updated.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function updateFail(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('update a bill and fail');
|
||||
$I->amOnPage('/bills/edit/1');
|
||||
$I->submitForm(
|
||||
'#update', [
|
||||
'name' => 'Some bill',
|
||||
'match' => '',
|
||||
'amount_min' => 10,
|
||||
'amount_max' => 20,
|
||||
'date' => date('Y-m-d'),
|
||||
'repeat_freq' => 'monthly',
|
||||
'skip' => 0
|
||||
]
|
||||
);
|
||||
$I->see('Could not update bill');
|
||||
}
|
||||
|
||||
}
|
@@ -82,6 +82,19 @@ class BudgetControllerCest
|
||||
$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
|
||||
*/
|
||||
@@ -138,18 +151,6 @@ class BudgetControllerCest
|
||||
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
|
||||
*/
|
||||
@@ -174,6 +175,17 @@ class BudgetControllerCest
|
||||
$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
|
||||
@@ -189,35 +201,6 @@ class BudgetControllerCest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public function validateUpdateOnly(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('update a budget and validate only');
|
||||
$I->amOnPage('/budgets/edit/3');
|
||||
$I->see('Edit budget "Delete me"');
|
||||
$I->submitForm(
|
||||
'#update', ['name' => 'Validate Only', 'post_submit_action' => 'validate_only']
|
||||
);
|
||||
$I->dontSeeRecord('budgets', ['name' => 'Savings accountXX']);
|
||||
$I->seeRecord('budgets', ['name' => 'Delete me']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
@@ -242,4 +225,20 @@ class BudgetControllerCest
|
||||
$I->wantTo('update my monthly income');
|
||||
$I->see('Update (expected) income for ');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function validateUpdateOnly(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('update a budget and validate only');
|
||||
$I->amOnPage('/budgets/edit/3');
|
||||
$I->see('Edit budget "Delete me"');
|
||||
$I->submitForm(
|
||||
'#update', ['name' => 'Validate Only', 'post_submit_action' => 'validate_only']
|
||||
);
|
||||
$I->dontSeeRecord('budgets', ['name' => 'Savings accountXX']);
|
||||
$I->seeRecord('budgets', ['name' => 'Delete me']);
|
||||
|
||||
}
|
||||
}
|
@@ -65,6 +65,19 @@ class CategoryControllerCest
|
||||
$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
|
||||
*/
|
||||
@@ -97,19 +110,6 @@ class CategoryControllerCest
|
||||
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
|
||||
*/
|
||||
@@ -135,6 +135,20 @@ class CategoryControllerCest
|
||||
$I->dontSeeRecord('categories', ['name' => 'New category.']);
|
||||
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
|
||||
*/
|
||||
@@ -152,13 +166,15 @@ class CategoryControllerCest
|
||||
/**
|
||||
* @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->see('Edit category "Delete me"');
|
||||
$I->submitForm('#update', ['name' => '', 'post_submit_action' => 'update']);
|
||||
$I->seeRecord('categories', ['name' => 'Delete me']);
|
||||
$I->submitForm(
|
||||
'#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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
@@ -57,16 +67,6 @@ class CurrencyControllerCest
|
||||
$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
|
||||
*/
|
||||
@@ -87,6 +87,19 @@ class CurrencyControllerCest
|
||||
$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
|
||||
*/
|
||||
@@ -162,13 +175,15 @@ class CurrencyControllerCest
|
||||
/**
|
||||
* @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->see('Edit currency "US Dollar"');
|
||||
$I->submitForm('#update', ['name' => 'Failed update', 'code' => '123', 'post_submit_action' => 'update']);
|
||||
$I->dontSeeRecord('transaction_currencies', ['name' => 'Failed update']);
|
||||
$I->submitForm(
|
||||
'#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']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public function accountBalanceChart(FunctionalTester $I)
|
||||
public function accountAllBalanceChart(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see the session balance chart of an account.');
|
||||
$I->amOnPage('chart/account/1/session');
|
||||
$I->wantTo('see the complete balance chart of an account.');
|
||||
$I->amOnPage('chart/account/1/all');
|
||||
$I->seeResponseCodeIs(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function accountAllBalanceChart(FunctionalTester $I)
|
||||
public function accountBalanceChart(FunctionalTester $I)
|
||||
{
|
||||
$I->wantTo('see the complete balance chart of an account.');
|
||||
$I->amOnPage('chart/account/1/all');
|
||||
$I->wantTo('see the session balance chart of an account.');
|
||||
$I->amOnPage('chart/account/1/session');
|
||||
$I->seeResponseCodeIs(200);
|
||||
}
|
||||
|
||||
@@ -73,6 +73,26 @@ class GoogleChartControllerCest
|
||||
$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
|
||||
*/
|
||||
@@ -125,26 +145,6 @@ class GoogleChartControllerCest
|
||||
$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
|
||||
*/
|
||||
@@ -158,10 +158,10 @@ class GoogleChartControllerCest
|
||||
/**
|
||||
* @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->amOnPage('/chart/home/bills');
|
||||
$I->wantTo('see the chart for the history of a piggy bank');
|
||||
$I->amOnPage('/chart/piggy_history/1');
|
||||
$I->seeResponseCodeIs(200);
|
||||
}
|
||||
|
||||
|
@@ -281,29 +281,6 @@ class PiggyBankControllerCest
|
||||
$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!');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
@@ -126,25 +146,5 @@ class ProfileControllerCest
|
||||
$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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
@@ -65,14 +75,4 @@ class ReminderControllerCest
|
||||
$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.');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user