Will implement changes to test database.

This commit is contained in:
James Cole 2016-05-14 17:08:28 +02:00
parent 771926c779
commit f78d56b149
6 changed files with 793 additions and 77 deletions

1
.gitignore vendored
View File

@ -2,5 +2,4 @@
/node_modules
.env
storage/
.env.local

View File

@ -22,14 +22,9 @@ class DatabaseSeeder extends Seeder
$this->call('TransactionTypeSeeder');
$this->call('PermissionSeeder');
// set up basic test data (as little as possible):
if (App::environment() == 'testing' || App::environment() == 'local') {
if (App::environment() == 'testing') {
$this->call('TestDataSeeder');
}
// set up basic test data (as little as possible):
if (App::environment() == 'split') {
$this->call('SplitDataSeeder');
}
}
}

View File

@ -102,7 +102,7 @@ class SplitDataSeeder extends Seeder
$categories = ['Salary', 'Reimbursements'];
$amounts = [50, 50];
$destination = TestData::findAccount($user, 'Alternate Checking Account');
$date = new Carbon('2012-03-15');
$date = new Carbon('2012-03-12');
$journal = TransactionJournal::create(
['user_id' => $user->id, 'transaction_type_id' => 2, 'transaction_currency_id' => 1, 'description' => 'Split Even Income (journal (50/50))',
'completed' => 1, 'date' => $date->format('Y-m-d'),]
@ -134,6 +134,7 @@ class SplitDataSeeder extends Seeder
$amounts = [15, 34, 51];
$destination = TestData::findAccount($user, 'Checking Account');
$date = new Carbon;
$date->subDays(3);
$journal = TransactionJournal::create(
['user_id' => $user->id, 'transaction_type_id' => 2, 'transaction_currency_id' => 1,
'description' => 'Split Uneven Income (journal (15/34/51=100))', 'completed' => 1, 'date' => $date->format('Y-m-d'),]

View File

@ -41,81 +41,12 @@ class TestDataSeeder extends Seeder
*/
public function run()
{
// start by creating all users:
// method will return the first user.
$user = TestData::createUsers();
// create all kinds of static data:
TestData::createAssetAccounts($user, []);
TestData::createBills($user);
TestData::createBudgets($user);
TestData::createCategories($user);
TestData::createPiggybanks($user, 'TestData Savings');
TestData::createExpenseAccounts($user);
TestData::createRevenueAccounts($user);
TestData::createAttachments($user, $this->start);
TestData::openingBalanceSavings($user, $this->start);
TestData::createRules($user);
// loop from start to end, create dynamic info.
$current = clone $this->start;
while ($current < $this->end) {
$month = $current->format('F Y');
// create salaries:
TestData::createIncome($user, 'Salary ' . $month, $current, strval(rand(2000, 2100)));
// pay bills:
TestData::createRent($user, 'Rent for ' . $month, $current, '800');
TestData::createWater($user, 'Water bill for ' . $month, $current, '15');
TestData::createTV($user, 'TV bill for ' . $month, $current, '60');
TestData::createPower($user, 'Power bill for ' . $month, $current, '120');
// pay daily groceries:
TestData::createGroceries($user, $current);
// create tag (each type of tag, for date):
TestData::createTags($user, $current);
// go out for drinks:
TestData::createDrinksAndOthers($user, $current);
// save money every month:
TestData::createSavings($user, $current);
// buy gas for the car every month:
TestData::createCar($user, $current);
// create budget limits.
TestData::createBudgetLimit($user, $current, 'Groceries', '400');
TestData::createBudgetLimit($user, $current, 'Bills', '1000');
TestData::createBudgetLimit($user, $current, 'Car', '100');
$current->addMonth();
}
// create some special budget limits to test stuff with multiple budget limits
// for a range of dates:
$this->end->startOfMonth()->addDay();
$budget = TestData::findBudget($user, 'Bills');
$ranges = ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly'];
foreach ($ranges as $range) {
$limit = BudgetLimit::create(
[
'budget_id' => $budget->id,
'startdate' => $this->end->format('Y-m-d'),
'amount' => rand(100, 200),
'repeats' => 0,
'repeat_freq' => $range,
]
);
// also trigger event.
$thisEnd = Navigation::addPeriod($this->end, $range, 0);
$thisEnd->subDay();
event(new BudgetLimitStored($limit, $thisEnd));
$this->end->addDay();
}
// b
}
}

View File

@ -0,0 +1,788 @@
{
"users": [
{
"email": "thegrumpydictator@gmail.com",
"password": "james"
},
{
"email": "thegrumpydictator+empty@gmail.com",
"password": "james"
},
{
"email": "thegrumpydictator+deleteme@gmail.com",
"password": "james"
}
],
"roles": [
{
"user_id": 1,
"role": "owner"
}
],
"accounts": [
{
"user_id": 1,
"account_type_id": 3,
"name": "Checking Account",
"iban": "NL11XOLA6707795988"
},
{
"user_id": 1,
"account_type_id": 3,
"name": "Alternate Checking Account",
"iban": "NL40UKBK3619908726"
},
{
"user_id": 1,
"account_type_id": 3,
"name": "Savings Account",
"iban": "NL96DZCO4665940223"
},
{
"user_id": 1,
"account_type_id": 3,
"name": "Shared Checking Account",
"iban": "NL81RCQZ7160379858"
},
{
"user_id": 1,
"account_type_id": 3,
"name": "Emergency Savings Account",
"iban": "NL38SRMN4325934708"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Adobe"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Google"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Vitens"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Albert Heijn"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "PLUS",
"0": "Apple"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Bakker"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Belastingdienst"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "bol.com"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Cafe Central"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "conrad.nl"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Coolblue"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Shell"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "SixtyFive"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "EightyFour"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Fiftyone"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "DUO"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Etos"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "FEBO"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Greenchoice"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Halfords"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "XS4All"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "iCentre"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Jumper"
},
{
"user_id": 1,
"account_type_id": 4,
"name": "Land lord"
},
{
"user_id": 1,
"account_type_id": 5,
"name": "Job"
},
{
"user_id": 1,
"account_type_id": 5,
"name": "Belastingdienst"
},
{
"user_id": 1,
"account_type_id": 5,
"name": "Bank"
},
{
"user_id": 1,
"account_type_id": 5,
"name": "KPN"
},
{
"user_id": 1,
"account_type_id": 5,
"name": "Google"
},
{
"user_id": 1,
"account_type_id": 5,
"name": "Work SixtyFive"
},
{
"user_id": 1,
"account_type_id": 5,
"name": "Work EightyFour"
},
{
"user_id": 1,
"account_type_id": 5,
"name": "Work Fiftyone"
},
{
"user_id": 1,
"account_type_id": 6,
"name": "Opposing for Savings Account"
},
{
"user_id": 1,
"account_type_id": 6,
"name": "Opposing for Emergency Savings Account"
}
],
"account-meta": [
{
"account_id": 1,
"name": "accountRole",
"data": "\"defaultAsset\""
},
{
"account_id": 2,
"name": "accountRole",
"data": "\"defaultAsset\""
},
{
"account_id": 3,
"name": "accountRole",
"data": "\"savingAsset\""
},
{
"account_id": 4,
"name": "accountRole",
"data": "\"sharedAsset\""
}
],
"bills": [
{
"name": "Rent",
"match": "rent,land,lord",
"amount_min": 795,
"amount_max": 805,
"user_id": 1,
"date": "2015-01-01",
"active": 1,
"automatch": 1,
"repeat_freq": "monthly",
"skip": 0
},
{
"name": "Health insurance",
"match": "insurer,insurance,health",
"amount_min": 120,
"amount_max": 140,
"user_id": 1,
"date": "2015-01-01",
"active": 1,
"automatch": 1,
"repeat_freq": "monthly",
"skip": 0
}
],
"budgets": [
{
"name": "Groceries",
"user_id": 1
},
{
"name": "Bills",
"user_id": 1
},
{
"name": "Car",
"user_id": 1
},
{
"name": "One Empty Budget",
"user_id": 1
},
{
"name": "Another Empty Budget",
"user_id": 1
}
],
"budget-limits": [
{
"budget_id": 1,
"startdate": "2016-05-01",
"amount": 196,
"repeats": 0,
"repeat_freq": "daily"
},
{
"budget_id": 1,
"startdate": "2016-05-01",
"amount": 154,
"repeats": 0,
"repeat_freq": "weekly"
},
{
"budget_id": 1,
"startdate": "2016-05-01",
"amount": 159,
"repeats": 0,
"repeat_freq": "monthly"
},
{
"budget_id": 1,
"startdate": "2016-05-01",
"amount": 157,
"repeats": 0,
"repeat_freq": "quarterly"
},
{
"budget_id": 1,
"startdate": "2016-05-01",
"amount": 190,
"repeats": 0,
"repeat_freq": "half-year"
},
{
"budget_id": 1,
"startdate": "2016-05-01",
"amount": 145,
"repeats": 0,
"repeat_freq": "yearly"
}
],
"monthly-limits": [
{
"budget_id": 1,
"amount": 100
},
{
"budget_id": 2,
"amount": 100
},
{
"budget_id": 3,
"amount": 100
}
],
"categories": [
{
"name": "Groceries",
"user_id": 1
},
{
"name": "Car",
"user_id": 1
},
{
"name": "Reimbursements",
"user_id": 1
},
{
"name": "Salary",
"user_id": 1
}
],
"piggy-banks": [
{
"account_id": 3,
"name": "New camera",
"targetamount": 1000,
"startdate": "2015-04-01",
"reminder_skip": 0,
"remind_me": 0,
"order": 1,
"currentamount": 735
},
{
"account_id": 3,
"name": "New phone",
"targetamount": 600,
"startdate": "2015-04-01",
"reminder_skip": 0,
"remind_me": 0,
"order": 2,
"currentamount": 333
},
{
"account_id": 3,
"name": "New couch",
"targetamount": 500,
"startdate": "2015-04-01",
"reminder_skip": 0,
"remind_me": 0,
"order": 3,
"currentamount": 120
}
],
"piggy-events": [
{
"piggy_bank_id": 1,
"date": "2015-05-01",
"amount": 245
},
{
"piggy_bank_id": 1,
"date": "2015-06-02",
"amount": 245
},
{
"piggy_bank_id": 1,
"date": "2015-07-03",
"amount": 245
},
{
"piggy_bank_id": 2,
"date": "2015-08-04",
"amount": 111
},
{
"piggy_bank_id": 2,
"date": "2015-09-05",
"amount": 111
},
{
"piggy_bank_id": 2,
"date": "2015-10-06",
"amount": 111
},
{
"piggy_bank_id": 3,
"date": "2015-11-07",
"amount": 40
},
{
"piggy_bank_id": 3,
"date": "2015-12-08",
"amount": 40
},
{
"piggy_bank_id": 3,
"date": "2016-01-09",
"amount": 40
}
],
"rule-groups": [
{
"user_id": 1,
"order": 1,
"title": "Default rules",
"description": "All your rules not in a particular group."
}
],
"rules": [
{
"user_id": 1,
"rule_group_id": 1,
"order": 1,
"active": 1,
"stop_processing": 0,
"title": "Your first default rule",
"description": "This rule is an example. You can safely delete it."
}
],
"rule-triggers": [
{
"rule_id": 1,
"order": 1,
"active": 1,
"stop_processing": 0,
"trigger_type": "user_action",
"trigger_value": "store-journal"
},
{
"rule_id": 1,
"order": 2,
"active": 1,
"stop_processing": 0,
"trigger_type": "description_is",
"trigger_value": "The Man Who Sold the World"
},
{
"rule_id": 1,
"order": 3,
"active": 1,
"stop_processing": 0,
"trigger_type": "from_account_is",
"trigger_value": "David Bowie"
}
],
"rule-actions": [
{
"rule_id": 1,
"order": 1,
"active": 1,
"action_type": "prepend_description",
"action_value": "Bought the world from "
},
{
"rule_id": 1,
"order": 2,
"active": 1,
"action_type": "set_category",
"action_value": "Large expenses"
}
],
"tags": [
{
"user_id": 1,
"tag": "TagJanuary",
"tagMode": "nothing",
"date": "2015-01-01"
},
{
"user_id": 1,
"tag": "TagFebruary",
"tagMode": "nothing",
"date": "2015-02-02"
},
{
"user_id": 1,
"tag": "TagMarch",
"tagMode": "nothing",
"date": "2015-03-03"
},
{
"user_id": 1,
"tag": "TagApril",
"tagMode": "nothing",
"date": "2015-04-04"
},
{
"user_id": 1,
"tag": "TagMay",
"tagMode": "nothing",
"date": "2015-05-05"
},
{
"user_id": 1,
"tag": "TagJune",
"tagMode": "nothing",
"date": "2015-06-06"
},
{
"user_id": 1,
"tag": "TagJuly",
"tagMode": "nothing",
"date": "2015-07-07"
},
{
"user_id": 1,
"tag": "TagAugust",
"tagMode": "nothing",
"date": "2015-08-08"
},
{
"user_id": 1,
"tag": "TagSeptember",
"tagMode": "nothing",
"date": "2015-09-09"
},
{
"user_id": 1,
"tag": "TagOctober",
"tagMode": "nothing",
"date": "2015-10-10"
},
{
"user_id": 1,
"tag": "TagNovember",
"tagMode": "nothing",
"date": "2015-11-11"
},
{
"user_id": 1,
"tag": "TagDecember",
"tagMode": "nothing",
"date": "2015-12-12"
}
],
"monthly-deposits": [
{
"user": 1,
"day-of-month": 24,
"description": "Salary in :month",
"source": "Job",
"destination": "Checking Account",
"min_amount": 2000,
"max_amount": 2100
}
],
"monthly-transfers": [
{
"user": 1,
"day-of-month": 28,
"description": "Saving money for :month",
"source": "Checking Account",
"destination": "Savings Account",
"min_amount": 150,
"max_amount": 150
}
],
"monthly-withdrawals": [
{
"user": 1,
"day-of-month": 2,
"description": "Rent for :month",
"source": "Checking Account",
"destination": "Land lord",
"min_amount": 800,
"max_amount": 800
},
{
"user": 1,
"day-of-month": 4,
"description": "Water bill :month",
"source": "Checking Account",
"destination": "Land lord",
"min_amount": 800,
"max_amount": 800
},
{
"user": 1,
"day-of-month": 6,
"description": "TV bill :month",
"source": "Checking Account",
"destination": "Land lord",
"min_amount": 800,
"max_amount": 800
},
{
"user": 1,
"day-of-month": 8,
"description": "Power bill :month",
"source": "Checking Account",
"destination": "Land lord",
"min_amount": 800,
"max_amount": 800
},
{
"user": 1,
"day-of-month": 7,
"description": "Bought gas",
"source": "Checking Account",
"destination": "Shell",
"min_amount": 40,
"max_amount": 50
},
{
"user": 1,
"day-of-month": 17,
"description": "Filled the car up again",
"source": "Checking Account",
"destination": "Shell",
"min_amount": 40,
"max_amount": 50
},
{
"user": 1,
"day-of-month": 27,
"description": "Needed gas again",
"source": "Checking Account",
"destination": "Shell",
"min_amount": 45,
"max_amount": 55
},
{
"user": 1,
"day-of-month": 2,
"description": "Groceries",
"source": "Checking Account",
"destination": "Albert Heijn",
"min_amount": 15,
"max_amount": 25
},
{
"user": 1,
"day-of-month": 6,
"description": "Groceries",
"source": "Checking Account",
"destination": "PLUS",
"min_amount": 15,
"max_amount": 25
},
{
"user": 1,
"day-of-month": 8,
"description": "Groceries",
"source": "Checking Account",
"destination": "Bakker",
"min_amount": 15,
"max_amount": 25
},
{
"user": 1,
"day-of-month": 11,
"description": "Groceries",
"source": "Checking Account",
"destination": "Albert Heijn",
"min_amount": 15,
"max_amount": 25
},
{
"user": 1,
"day-of-month": 15,
"description": "Groceries",
"source": "Checking Account",
"destination": "PLUS",
"min_amount": 15,
"max_amount": 25
},
{
"user": 1,
"day-of-month": 19,
"description": "Groceries",
"source": "Checking Account",
"destination": "Albert Heijn",
"min_amount": 15,
"max_amount": 25
},
{
"user": 1,
"day-of-month": 23,
"description": "Groceries",
"source": "Checking Account",
"destination": "Bakker",
"min_amount": 15,
"max_amount": 25
},
{
"user": 1,
"day-of-month": 26,
"description": "Groceries",
"source": "Checking Account",
"destination": "Albert Heijn",
"min_amount": 15,
"max_amount": 25
},
{
"user": 1,
"day-of-month": 23,
"description": "Going out for drinks",
"source": "Checking Account",
"destination": "Cafe Central",
"min_amount": 15,
"max_amount": 36
},
{
"user": 1,
"day-of-month": 26,
"description": "Going out for drinks again",
"source": "Checking Account",
"destination": "Cafe Central",
"min_amount": 15,
"max_amount": 36
}
],
"attachments": [
{
"attachable_id": 1,
"attachable_type": "FireflyIII\\Models\\TransactionJournal",
"user_id": 1,
"content": "This is attachment number one.",
"filename": "empty-file.txt",
"title": "Empty file",
"description": "This file is empty",
"notes": "Some notes",
"mime": "text\/plain",
"uploaded": 1
},
{
"attachable_id": 2,
"attachable_type": "FireflyIII\\Models\\TransactionJournal",
"user_id": 1,
"content": "This is attachment number two.",
"filename": "empty-file.txt",
"title": "Empty file",
"description": "This file is empty",
"notes": "Some notes",
"mime": "text\/plain",
"uploaded": 1
}
]
}

2
storage/debugbar/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore