From 07ad43f7a2e49ba48477dc24e684d3eb66237ef0 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 7 Feb 2015 12:15:53 +0100 Subject: [PATCH] Updated models and tests to match. --- app/Models/Account.php | 2 +- app/Models/AccountMeta.php | 4 ++++ app/Models/AccountType.php | 4 ++++ app/Models/Bill.php | 4 ++++ app/Models/Budget.php | 4 ++++ app/Models/BudgetLimit.php | 4 ++++ app/Models/Category.php | 4 ++++ app/Models/Component.php | 6 ++++-- app/Models/LimitRepetition.php | 4 ++++ app/Models/PiggyBank.php | 4 ++++ app/Models/PiggyBankEvent.php | 4 ++++ app/Models/PiggyBankRepetition.php | 4 ++++ app/Models/Preference.php | 4 ++++ app/Models/Reminder.php | 5 ++++- app/Models/Transaction.php | 5 ++++- app/Models/TransactionCurrency.php | 5 ++++- app/Models/TransactionGroup.php | 5 ++++- app/Models/TransactionJournal.php | 2 +- app/Models/TransactionRelation.php | 5 ++++- app/Models/TransactionType.php | 5 ++++- tests/functional/BillControllerCest.php | 2 ++ tests/functional/HomeControllerCest.php | 5 +++-- tests/functional/RelatedControllerCest.php | 2 ++ tests/functional/ReminderControllerCest.php | 2 +- tests/functional/RepeatedExpenseControllerCest.php | 2 +- tests/functional/TransactionControllerCest.php | 3 +++ 26 files changed, 86 insertions(+), 14 deletions(-) diff --git a/app/Models/Account.php b/app/Models/Account.php index 52895ec134..3af9852ccb 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -42,7 +42,7 @@ class Account extends Model public function getDates() { - return ['created_at', 'updated_at']; + return ['created_at', 'updated_at','deleted_at']; } } diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php index 9dc8b17ff2..27c5e4eb29 100644 --- a/app/Models/AccountMeta.php +++ b/app/Models/AccountMeta.php @@ -20,5 +20,9 @@ class AccountMeta extends Model { $this->attributes['data'] = json_encode($value); } + public function getDates() + { + return ['created_at', 'updated_at']; + } } diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php index 4933080210..f327a403c1 100644 --- a/app/Models/AccountType.php +++ b/app/Models/AccountType.php @@ -10,4 +10,8 @@ class AccountType extends Model { return $this->hasMany('FireflyIII\Models\Account'); } + public function getDates() + { + return ['created_at', 'updated_at']; + } } diff --git a/app/Models/Bill.php b/app/Models/Bill.php index 1ef82afe84..afa5703c79 100644 --- a/app/Models/Bill.php +++ b/app/Models/Bill.php @@ -14,6 +14,10 @@ class Bill extends Model { return $this->belongsTo('FireflyIII\User'); } + public function getDates() + { + return ['created_at', 'updated_at','date']; + } } diff --git a/app/Models/Budget.php b/app/Models/Budget.php index 469f8c791b..e1e0f17607 100644 --- a/app/Models/Budget.php +++ b/app/Models/Budget.php @@ -25,6 +25,10 @@ class Budget extends Model { return $this->belongsTo('FireflyIII\User'); } + public function getDates() + { + return ['created_at', 'updated_at','deleted_at']; + } } diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php index c9723f7f9b..bc7d704aec 100644 --- a/app/Models/BudgetLimit.php +++ b/app/Models/BudgetLimit.php @@ -14,5 +14,9 @@ class BudgetLimit extends Model { return $this->hasMany('FireflyIII\Models\LimitRepetition'); } + public function getDates() + { + return ['created_at', 'updated_at','startdate']; + } } diff --git a/app/Models/Category.php b/app/Models/Category.php index 4e74ae7b69..167178fe5d 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -14,5 +14,9 @@ class Category extends Model { return $this->belongsTo('FireflyIII\User'); } + public function getDates() + { + return ['created_at', 'updated_at','deleted_at']; + } } diff --git a/app/Models/Component.php b/app/Models/Component.php index d8b590a4f7..3f64bdb690 100644 --- a/app/Models/Component.php +++ b/app/Models/Component.php @@ -5,6 +5,8 @@ use Illuminate\Database\Eloquent\Model; class Component extends Model { - // - + public function getDates() + { + return ['created_at', 'updated_at','deleted_at']; + } } diff --git a/app/Models/LimitRepetition.php b/app/Models/LimitRepetition.php index c485bc7add..d2f77a7750 100644 --- a/app/Models/LimitRepetition.php +++ b/app/Models/LimitRepetition.php @@ -9,5 +9,9 @@ class LimitRepetition extends Model { return $this->belongsTo('FireflyIII\Models\BudgetLimit'); } + public function getDates() + { + return ['created_at', 'updated_at','startdate','enddate']; + } } diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index 5d1eb4ee33..1a7e9920c4 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -24,4 +24,8 @@ class PiggyBank extends Model { return $this->morphMany('FireflyIII\Models\Reminder', 'remindersable'); } + public function getDates() + { + return ['created_at', 'updated_at','deleted_at','startdate','targetdate']; + } } diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php index 405fb14b2b..9c21182c6a 100644 --- a/app/Models/PiggyBankEvent.php +++ b/app/Models/PiggyBankEvent.php @@ -14,5 +14,9 @@ class PiggyBankEvent extends Model { return $this->belongsTo('FireflyIII\Models\TransactionJournal'); } + public function getDates() + { + return ['created_at', 'updated_at','date']; + } } diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.php index 356373b4cf..14675c3cfc 100644 --- a/app/Models/PiggyBankRepetition.php +++ b/app/Models/PiggyBankRepetition.php @@ -9,5 +9,9 @@ class PiggyBankRepetition extends Model { return $this->belongsTo('FireflyIII\Models\PiggyBank'); } + public function getDates() + { + return ['created_at', 'updated_at','startdate','targetdate']; + } } diff --git a/app/Models/Preference.php b/app/Models/Preference.php index b06be83545..42e3086b7a 100644 --- a/app/Models/Preference.php +++ b/app/Models/Preference.php @@ -19,5 +19,9 @@ class Preference extends Model { return $this->belongsTo('FireflyIII\User'); } + public function getDates() + { + return ['created_at', 'updated_at']; + } } diff --git a/app/Models/Reminder.php b/app/Models/Reminder.php index 124cc12cd4..784fee62e0 100644 --- a/app/Models/Reminder.php +++ b/app/Models/Reminder.php @@ -14,6 +14,9 @@ class Reminder extends Model { return $this->belongsTo('FireflyIII\User'); } - + public function getDates() + { + return ['created_at', 'updated_at','startdate','enddate']; + } } diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index afe1adf8ce..8421c02662 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -14,5 +14,8 @@ class Transaction extends Model { return $this->belongsTo('FireflyIII\Models\TransactionJournal'); } - + public function getDates() + { + return ['created_at', 'updated_at','deleted_at']; + } } diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php index d30539b27c..557e4e406f 100644 --- a/app/Models/TransactionCurrency.php +++ b/app/Models/TransactionCurrency.php @@ -9,5 +9,8 @@ class TransactionCurrency extends Model { return $this->hasMany('FireflyIII\Models\TransactionJournal'); } - + public function getDates() + { + return ['created_at', 'updated_at','deleted_at']; + } } diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php index e9369265ed..aae86f6222 100644 --- a/app/Models/TransactionGroup.php +++ b/app/Models/TransactionGroup.php @@ -14,6 +14,9 @@ class TransactionGroup extends Model { return $this->belongsTo('FireflyIII\User'); } - + public function getDates() + { + return ['created_at', 'updated_at','deleted_at']; + } } diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index 15f6a1e2db..75e32a531b 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -25,7 +25,7 @@ class TransactionJournal extends Model public function getDates() { - return ['created_at', 'updated_at', 'date']; + return ['created_at', 'updated_at', 'date','deleted_at']; } public function getDescriptionAttribute($value) diff --git a/app/Models/TransactionRelation.php b/app/Models/TransactionRelation.php index b4370b2966..f2eba009e4 100644 --- a/app/Models/TransactionRelation.php +++ b/app/Models/TransactionRelation.php @@ -5,6 +5,9 @@ use Illuminate\Database\Eloquent\Model; class TransactionRelation extends Model { - // + public function getDates() + { + return ['created_at', 'updated_at']; + } } diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php index 37acae6acb..89f717ef7b 100644 --- a/app/Models/TransactionType.php +++ b/app/Models/TransactionType.php @@ -9,5 +9,8 @@ class TransactionType extends Model { return $this->hasMany('FireflyIII\Models\TransactionJournal'); } - + public function getDates() + { + return ['created_at', 'updated_at','deleted_at']; + } } diff --git a/tests/functional/BillControllerCest.php b/tests/functional/BillControllerCest.php index 5347420f5a..5c5362548c 100644 --- a/tests/functional/BillControllerCest.php +++ b/tests/functional/BillControllerCest.php @@ -1,5 +1,7 @@ delete(); - \Preference::create( + Preference::whereName('frontPageAccounts')->delete(); + Preference::create( [ 'user_id' => 1, 'name' => 'frontPageAccounts', diff --git a/tests/functional/RelatedControllerCest.php b/tests/functional/RelatedControllerCest.php index e4b30cd11e..1914bf7633 100644 --- a/tests/functional/RelatedControllerCest.php +++ b/tests/functional/RelatedControllerCest.php @@ -1,5 +1,7 @@