From 6fa8c33672c2213cc845e06f24ae0155a71997eb Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 30 Jan 2016 07:36:11 +0100 Subject: [PATCH] Fixed some bugs in test data. --- database/seeds/TestDataSeeder.php | 5 ++-- database/seeds/VisualTestDataSeeder.php | 35 +++++++++++++------------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/database/seeds/TestDataSeeder.php b/database/seeds/TestDataSeeder.php index 8e454e974a..05795f4679 100644 --- a/database/seeds/TestDataSeeder.php +++ b/database/seeds/TestDataSeeder.php @@ -2,15 +2,14 @@ use Carbon\Carbon; use FireflyIII\Models\Account; -use FireflyIII\Models\AccountMeta; use FireflyIII\Models\Attachment; -use FireflyIII\Models\Bill; use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\Category; use FireflyIII\Models\Role; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; +use FireflyIII\Support\Migration\TestData; use FireflyIII\User; use Illuminate\Database\Seeder; @@ -73,6 +72,7 @@ class TestDataSeeder extends Seeder // create opening balance for savings account: $this->openingBalanceSavings($user); } + /** * @param User $user */ @@ -149,6 +149,7 @@ class TestDataSeeder extends Seeder file_put_contents(storage_path('upload/at-2.data'), $encrypted); } + /** * @param $user */ diff --git a/database/seeds/VisualTestDataSeeder.php b/database/seeds/VisualTestDataSeeder.php index aa2030390b..6c6810d137 100644 --- a/database/seeds/VisualTestDataSeeder.php +++ b/database/seeds/VisualTestDataSeeder.php @@ -1,7 +1,6 @@ active = 1; $ruleTrigger->stop_processing = 0; $ruleTrigger->trigger_type = 'from_account_is'; - $ruleTrigger->trigger_value = 'MyBank Checking Account'; + $ruleTrigger->trigger_value = 'TestData Checking Account'; $ruleTrigger->save(); unset($ruleTrigger); @@ -179,7 +180,7 @@ class VisualTestDataSeeder extends Seeder $ruleTrigger->active = 1; $ruleTrigger->stop_processing = 0; $ruleTrigger->trigger_type = 'from_account_is'; - $ruleTrigger->trigger_value = 'MyBank Checking Account'; + $ruleTrigger->trigger_value = 'TestData Checking Account'; $ruleTrigger->save(); unset($ruleTrigger); @@ -261,7 +262,7 @@ class VisualTestDataSeeder extends Seeder $ruleTrigger->active = 1; $ruleTrigger->stop_processing = 0; $ruleTrigger->trigger_type = 'from_account_is'; - $ruleTrigger->trigger_value = 'MyBank Checking Account'; + $ruleTrigger->trigger_value = 'TestData Checking Account'; $ruleTrigger->save(); unset($ruleTrigger); @@ -273,7 +274,7 @@ class VisualTestDataSeeder extends Seeder $ruleTrigger->active = 1; $ruleTrigger->stop_processing = 0; $ruleTrigger->trigger_type = 'to_account_is'; - $ruleTrigger->trigger_value = 'Savings'; + $ruleTrigger->trigger_value = 'TestData Savings'; $ruleTrigger->save(); unset($ruleTrigger); @@ -332,7 +333,7 @@ class VisualTestDataSeeder extends Seeder $ruleTrigger->active = 1; $ruleTrigger->stop_processing = 0; $ruleTrigger->trigger_type = 'from_account_is'; - $ruleTrigger->trigger_value = 'MyBank Checking Account'; + $ruleTrigger->trigger_value = 'TestData Checking Account'; $ruleTrigger->save(); unset($ruleTrigger); @@ -402,7 +403,7 @@ class VisualTestDataSeeder extends Seeder $ruleTrigger->active = 1; $ruleTrigger->stop_processing = 1; $ruleTrigger->trigger_type = 'from_account_is'; - $ruleTrigger->trigger_value = 'MyBank Checking Account'; + $ruleTrigger->trigger_value = 'TestData Checking Account'; $ruleTrigger->save(); unset($ruleTrigger); @@ -527,7 +528,7 @@ class VisualTestDataSeeder extends Seeder { // twice: $date = new Carbon($date->format('Y-m') . '-10'); // paid on 10th - $fromAccount = TestData::findAccount($this->user, 'MyBank Checking Account'); + $fromAccount = TestData::findAccount($this->user, 'TestData Checking Account'); $toAccount = TestData::findAccount($this->user, 'Shell'); $category = Category::firstOrCreateEncrypted(['name' => 'Car', 'user_id' => $this->user->id]); $budget = Budget::firstOrCreateEncrypted(['name' => 'Car', 'user_id' => $this->user->id]); @@ -615,7 +616,7 @@ class VisualTestDataSeeder extends Seeder // weekly drink: $thisDate = clone $current; $thisDate->addDay(); - $fromAccount = TestData::findAccount($this->user, 'MyBank Checking Account'); + $fromAccount = TestData::findAccount($this->user, 'TestData Checking Account'); $toAccount = TestData::findAccount($this->user, 'Cafe Central'); $category = Category::firstOrCreateEncrypted(['name' => 'Drinks', 'user_id' => $this->user->id]); $budget = Budget::firstOrCreateEncrypted(['name' => 'Going out', 'user_id' => $this->user->id]); @@ -688,7 +689,7 @@ class VisualTestDataSeeder extends Seeder $start->startOfMonth(); $end->endOfMonth(); - $fromAccount = TestData::findAccount($this->user, 'MyBank Checking Account'); + $fromAccount = TestData::findAccount($this->user, 'TestData Checking Account'); $stores = ['Albert Heijn', 'PLUS', 'Bakker']; $descriptions = ['Groceries', 'Bought some groceries', 'Got groceries']; $category = Category::firstOrCreateEncrypted(['name' => 'Daily groceries', 'user_id' => $this->user->id]); @@ -750,7 +751,7 @@ class VisualTestDataSeeder extends Seeder if ($date >= $today) { return null; } - $toAccount = TestData::findAccount($this->user, 'MyBank Checking Account'); + $toAccount = TestData::findAccount($this->user, 'TestData Checking Account'); $fromAccount = TestData::findAccount($this->user, 'Job'); $category = Category::firstOrCreateEncrypted(['name' => 'Salary', 'user_id' => $this->user->id]); // create journal: @@ -797,7 +798,7 @@ class VisualTestDataSeeder extends Seeder protected function createPower($description, Carbon $date, $amount) { $date = new Carbon($date->format('Y-m') . '-06'); // paid on 10th - $fromAccount = TestData::findAccount($this->user, 'MyBank Checking Account'); + $fromAccount = TestData::findAccount($this->user, 'TestData Checking Account'); $toAccount = TestData::findAccount($this->user, 'Greenchoice'); $category = Category::firstOrCreateEncrypted(['name' => 'House', 'user_id' => $this->user->id]); $budget = Budget::firstOrCreateEncrypted(['name' => 'Bills', 'user_id' => $this->user->id]); @@ -852,7 +853,7 @@ class VisualTestDataSeeder extends Seeder */ protected function createRent($description, Carbon $date, $amount) { - $fromAccount = TestData::findAccount($this->user, 'MyBank Checking Account'); + $fromAccount = TestData::findAccount($this->user, 'TestData Checking Account'); $toAccount = TestData::findAccount($this->user, 'Land lord'); $category = Category::firstOrCreateEncrypted(['name' => 'Rent', 'user_id' => $this->user->id]); $budget = Budget::firstOrCreateEncrypted(['name' => 'Bills', 'user_id' => $this->user->id]); @@ -918,8 +919,8 @@ class VisualTestDataSeeder extends Seeder protected function createSavings(Carbon $date) { $date = new Carbon($date->format('Y-m') . '-24'); // paid on 24th. - $toAccount = TestData::findAccount($this->user, 'Savings'); - $fromAccount = TestData::findAccount($this->user, 'MyBank Checking Account'); + $toAccount = TestData::findAccount($this->user, 'TestData Savings'); + $fromAccount = TestData::findAccount($this->user, 'TestData Checking Account'); $category = Category::firstOrCreateEncrypted(['name' => 'Money management', 'user_id' => $this->user->id]); // create journal: @@ -965,7 +966,7 @@ class VisualTestDataSeeder extends Seeder protected function createTV($description, Carbon $date, $amount) { $date = new Carbon($date->format('Y-m') . '-15'); // paid on 10th - $fromAccount = TestData::findAccount($this->user, 'MyBank Checking Account'); + $fromAccount = TestData::findAccount($this->user, 'TestData Checking Account'); $toAccount = TestData::findAccount($this->user, 'XS4All'); $category = Category::firstOrCreateEncrypted(['name' => 'House', 'user_id' => $this->user->id]); $budget = Budget::firstOrCreateEncrypted(['name' => 'Bills', 'user_id' => $this->user->id]); @@ -1043,7 +1044,7 @@ class VisualTestDataSeeder extends Seeder protected function createWater($description, Carbon $date, $amount) { $date = new Carbon($date->format('Y-m') . '-10'); // paid on 10th - $fromAccount = TestData::findAccount($this->user, 'MyBank Checking Account'); + $fromAccount = TestData::findAccount($this->user, 'TestData Checking Account'); $toAccount = TestData::findAccount($this->user, 'Vitens'); $category = Category::firstOrCreateEncrypted(['name' => 'House', 'user_id' => $this->user->id]); $budget = Budget::firstOrCreateEncrypted(['name' => 'Bills', 'user_id' => $this->user->id]);