mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Various bug fixes and extensions to test routine.
This commit is contained in:
@@ -11,8 +11,6 @@ install:
|
|||||||
- php artisan clear-compiled
|
- php artisan clear-compiled
|
||||||
- php artisan optimize
|
- php artisan optimize
|
||||||
- php artisan env
|
- php artisan env
|
||||||
- ./test.sh -r
|
|
||||||
- php artisan env
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- phpunit
|
- phpunit
|
@@ -124,16 +124,16 @@ class VerifyDatabase extends Command
|
|||||||
{
|
{
|
||||||
$set = Budget::leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budgets.id')
|
$set = Budget::leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budgets.id')
|
||||||
->leftJoin('users', 'budgets.user_id', '=', 'users.id')
|
->leftJoin('users', 'budgets.user_id', '=', 'users.id')
|
||||||
->groupBy(['budgets.id', 'budgets.name', 'budgets.user_id', 'users.email'])
|
->groupBy(['budgets.id', 'budgets.name', 'budgets.encrypted', 'budgets.user_id', 'users.email'])
|
||||||
->whereNull('budget_limits.id')
|
->whereNull('budget_limits.id')
|
||||||
->get(['budgets.id', 'budgets.name', 'budgets.user_id', 'users.email']);
|
->get(['budgets.id', 'budgets.name', 'budgets.user_id', 'budgets.encrypted', 'users.email']);
|
||||||
|
|
||||||
/** @var stdClass $entry */
|
/** @var Budget $entry */
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
|
$name = $entry->encrypted ? Crypt::decrypt($entry->name) : $entry->name;
|
||||||
$line = sprintf(
|
$line = sprintf(
|
||||||
'Notice: User #%d (%s) has budget #%d ("%s") which has no budget limits.',
|
'Notice: User #%d (%s) has budget #%d ("%s") which has no budget limits.',
|
||||||
$entry->user_id, $entry->email, $entry->id, Crypt::decrypt($entry->name)
|
$entry->user_id, $entry->email, $entry->id, $name
|
||||||
);
|
);
|
||||||
$this->line($line);
|
$this->line($line);
|
||||||
}
|
}
|
||||||
|
@@ -60,6 +60,7 @@ class JournalCollector implements JournalCollectorInterface
|
|||||||
'transaction_types.type as transaction_type_type',
|
'transaction_types.type as transaction_type_type',
|
||||||
'transaction_journals.bill_id',
|
'transaction_journals.bill_id',
|
||||||
'bills.name as bill_name',
|
'bills.name as bill_name',
|
||||||
|
'bills.name_encrypted as bill_name_encrypted',
|
||||||
'transactions.id as id',
|
'transactions.id as id',
|
||||||
'transactions.amount as transaction_amount',
|
'transactions.amount as transaction_amount',
|
||||||
'transactions.description as transaction_description',
|
'transactions.description as transaction_description',
|
||||||
@@ -180,10 +181,12 @@ class JournalCollector implements JournalCollectorInterface
|
|||||||
$set->each(
|
$set->each(
|
||||||
function (Transaction $transaction) {
|
function (Transaction $transaction) {
|
||||||
$transaction->date = new Carbon($transaction->date);
|
$transaction->date = new Carbon($transaction->date);
|
||||||
$transaction->description = intval($transaction->encrypted) === 1 ? Crypt::decrypt($transaction->description) : $transaction->description;
|
$transaction->description = $transaction->encrypted ? Crypt::decrypt($transaction->description) : $transaction->description;
|
||||||
$transaction->bill_name = !is_null($transaction->bill_name) ? Crypt::decrypt($transaction->bill_name) : '';
|
|
||||||
|
if (!is_null($transaction->bill_name)) {
|
||||||
|
$transaction->bill_name = $transaction->bill_name_encrypted ? Crypt::decrypt($transaction->bill_name) : $transaction->bill_name;
|
||||||
|
}
|
||||||
|
|
||||||
// optionally decrypted:
|
|
||||||
try {
|
try {
|
||||||
$transaction->opposing_account_name = Crypt::decrypt($transaction->opposing_account_name);
|
$transaction->opposing_account_name = Crypt::decrypt($transaction->opposing_account_name);
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException $e) {
|
||||||
|
@@ -33,11 +33,13 @@ class Transaction extends Model
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $casts
|
protected $casts
|
||||||
= [
|
= [
|
||||||
'created_at' => 'date',
|
'created_at' => 'date',
|
||||||
'updated_at' => 'date',
|
'updated_at' => 'date',
|
||||||
'deleted_at' => 'date',
|
'deleted_at' => 'date',
|
||||||
'identifier' => 'int',
|
'identifier' => 'int',
|
||||||
|
'encrypted' => 'boolean', // model does not have these fields though
|
||||||
|
'bill_name_encrypted' => 'boolean',
|
||||||
];
|
];
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
protected $fillable = ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier'];
|
protected $fillable = ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier'];
|
||||||
|
10
test.sh
10
test.sh
@@ -7,7 +7,7 @@ BACKUPENV=./.env.current
|
|||||||
TESTINGENV=./.env.testing
|
TESTINGENV=./.env.testing
|
||||||
|
|
||||||
# do something with flags:
|
# do something with flags:
|
||||||
resetestflag=''
|
resetTestFlag=''
|
||||||
testflag=''
|
testflag=''
|
||||||
coverageflag=''
|
coverageflag=''
|
||||||
acceptancetestclass=''
|
acceptancetestclass=''
|
||||||
@@ -17,7 +17,7 @@ testsuite=''
|
|||||||
while getopts 'vcrta:s:' flag; do
|
while getopts 'vcrta:s:' flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
r)
|
r)
|
||||||
resetestflag='true'
|
resetTestFlag='true'
|
||||||
;;
|
;;
|
||||||
t)
|
t)
|
||||||
testflag='true'
|
testflag='true'
|
||||||
@@ -55,7 +55,7 @@ cp $TESTINGENV $ORIGINALENV
|
|||||||
php artisan cache:clear
|
php artisan cache:clear
|
||||||
|
|
||||||
# reset database (optional)
|
# reset database (optional)
|
||||||
if [[ $resetestflag == "true" ]]
|
if [[ $resetTestFlag == "true" ]]
|
||||||
then
|
then
|
||||||
echo "Must reset database"
|
echo "Must reset database"
|
||||||
|
|
||||||
@@ -69,12 +69,14 @@ then
|
|||||||
# run migration
|
# run migration
|
||||||
php artisan migrate:refresh --seed
|
php artisan migrate:refresh --seed
|
||||||
|
|
||||||
|
# call test data generation script
|
||||||
|
$(which php) /sites/FF3/test-data/artisan generate:data testing sqlite
|
||||||
# copy new database over backup (resets backup)
|
# copy new database over backup (resets backup)
|
||||||
cp $DATABASE $DATABASECOPY
|
cp $DATABASE $DATABASECOPY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# do not reset database (optional)
|
# do not reset database (optional)
|
||||||
if [[ $resetestflag == "" ]]
|
if [[ $resetTestFlag == "" ]]
|
||||||
then
|
then
|
||||||
echo "Will not reset database"
|
echo "Will not reset database"
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user