mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-17 01:42:19 +00:00
Expand tests, do code cleanup.
This commit is contained in:
@@ -59,6 +59,9 @@ class Account extends Model
|
||||
protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
|
||||
/** @var array */
|
||||
protected $hidden = ['encrypted'];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $rules
|
||||
= [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
@@ -216,7 +219,6 @@ class Account extends Model
|
||||
*
|
||||
* @return TransactionJournal
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getOpeningBalance(): TransactionJournal
|
||||
{
|
||||
@@ -267,7 +269,6 @@ class Account extends Model
|
||||
*
|
||||
* @return Carbon
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getOpeningBalanceDate(): Carbon
|
||||
{
|
||||
|
@@ -42,7 +42,10 @@ class AccountMeta extends Model
|
||||
];
|
||||
/** @var array */
|
||||
protected $fillable = ['account_id', 'name', 'data'];
|
||||
protected $table = 'account_meta';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'account_meta';
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
|
@@ -31,15 +31,42 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
class AccountType extends Model
|
||||
{
|
||||
const DEFAULT = 'Default account';
|
||||
const CASH = 'Cash account';
|
||||
const ASSET = 'Asset account';
|
||||
const EXPENSE = 'Expense account';
|
||||
const REVENUE = 'Revenue account';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const CASH = 'Cash account';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const ASSET = 'Asset account';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const EXPENSE = 'Expense account';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const REVENUE = 'Revenue account';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const INITIAL_BALANCE = 'Initial balance account';
|
||||
const BENEFICIARY = 'Beneficiary account';
|
||||
const IMPORT = 'Import account';
|
||||
const RECONCILIATION = 'Reconciliation account';
|
||||
const LOAN = 'Loan';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const BENEFICIARY = 'Beneficiary account';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const IMPORT = 'Import account';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const RECONCILIATION = 'Reconciliation account';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const LOAN = 'Loan';
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
|
@@ -53,11 +53,20 @@ class Bill extends Model
|
||||
'name_encrypted' => 'boolean',
|
||||
'match_encrypted' => 'boolean',
|
||||
];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable
|
||||
= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip',
|
||||
'automatch', 'active',];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];
|
||||
protected $rules = ['name' => 'required|between:1,200'];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $rules = ['name' => 'required|between:1,200'];
|
||||
|
||||
/**
|
||||
* @param Bill $value
|
||||
|
@@ -42,6 +42,9 @@ class Configuration extends Model
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'configuration';
|
||||
|
||||
/**
|
||||
|
@@ -44,6 +44,9 @@ class ImportJob extends Model
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $validStatus
|
||||
= [
|
||||
'new',
|
||||
@@ -176,6 +179,7 @@ class ImportJob extends Model
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function uploadFileContents(): string
|
||||
{
|
||||
|
@@ -65,6 +65,9 @@ class LinkType extends Model
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function transactionJournalLinks()
|
||||
{
|
||||
return $this->hasMany(TransactionJournalLink::class);
|
||||
|
@@ -42,8 +42,14 @@ class PiggyBankEvent extends Model
|
||||
];
|
||||
/** @var array */
|
||||
protected $dates = ['date'];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'amount'];
|
||||
protected $hidden = ['amount_encrypted'];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = ['amount_encrypted'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
|
@@ -41,7 +41,10 @@ class Role extends Model
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
protected $fillable = ['name','display_name','description'];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['name', 'display_name', 'description'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
|
@@ -46,6 +46,9 @@ class RuleGroup extends Model
|
||||
'order' => 'int',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['user_id', 'order', 'title', 'description', 'active'];
|
||||
|
||||
/**
|
||||
|
@@ -27,6 +27,9 @@ class SpectreProvider extends Model
|
||||
'data' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['spectre_id', 'code', 'mode', 'name', 'status', 'interactive', 'automatic_fetch', 'country_code', 'data'];
|
||||
|
||||
}
|
@@ -105,6 +105,7 @@ class Tag extends Model
|
||||
* @param Tag $tag
|
||||
*
|
||||
* @return string
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public static function tagSum(self $tag): string
|
||||
{
|
||||
|
@@ -84,10 +84,19 @@ class Transaction extends Model
|
||||
'bill_name_encrypted' => 'boolean',
|
||||
'reconciled' => 'boolean',
|
||||
];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable
|
||||
= ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier', 'transaction_currency_id', 'foreign_currency_id',
|
||||
'foreign_amount',];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = ['encrypted'];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $rules
|
||||
= [
|
||||
'account_id' => 'required|exists:accounts,id',
|
||||
|
@@ -32,6 +32,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class TransactionJournalLink extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'journal_links';
|
||||
|
||||
/**
|
||||
|
@@ -33,11 +33,26 @@ class TransactionType extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
const WITHDRAWAL = 'Withdrawal';
|
||||
const DEPOSIT = 'Deposit';
|
||||
const TRANSFER = 'Transfer';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const WITHDRAWAL = 'Withdrawal';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const DEPOSIT = 'Deposit';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const TRANSFER = 'Transfer';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const OPENING_BALANCE = 'Opening balance';
|
||||
const RECONCILIATION = 'Reconciliation';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const RECONCILIATION = 'Reconciliation';
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
|
Reference in New Issue
Block a user