mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-19 12:59:33 +00:00
Moved test data around.
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
namespace FireflyIII\Support\Migration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TestData.php
|
* TestData.php
|
||||||
* Copyright (C) 2016 Sander Dorigo
|
* Copyright (C) 2016 Sander Dorigo
|
||||||
@@ -6,15 +8,19 @@
|
|||||||
* This software may be modified and distributed under the terms
|
* This software may be modified and distributed under the terms
|
||||||
* of the MIT license. See the LICENSE file for details.
|
* of the MIT license. See the LICENSE file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\AccountMeta;
|
use FireflyIII\Models\AccountMeta;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
use FireflyIII\Models\PiggyBankEvent;
|
use FireflyIII\Models\PiggyBankEvent;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TestData
|
* Class TestData
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Support\Migration
|
||||||
*/
|
*/
|
||||||
class TestData
|
class TestData
|
||||||
{
|
{
|
||||||
@@ -54,6 +60,41 @@ class TestData
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
*/
|
||||||
|
public static function createBills(User $user)
|
||||||
|
{
|
||||||
|
Bill::create(
|
||||||
|
[
|
||||||
|
'name' => 'Rent',
|
||||||
|
'match' => 'rent,land,lord',
|
||||||
|
'amount_min' => 795,
|
||||||
|
'amount_max' => 805,
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'date' => '2015-01-01',
|
||||||
|
'active' => 1,
|
||||||
|
'automatch' => 1,
|
||||||
|
'repeat_freq' => 'monthly',
|
||||||
|
'skip' => 0,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
Bill::create(
|
||||||
|
[
|
||||||
|
'name' => 'Health insurance',
|
||||||
|
'match' => 'zilveren,kruis,health',
|
||||||
|
'amount_min' => 120,
|
||||||
|
'amount_max' => 140,
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'date' => '2015-01-01',
|
||||||
|
'active' => 1,
|
||||||
|
'automatch' => 1,
|
||||||
|
'repeat_freq' => 'monthly',
|
||||||
|
'skip' => 0,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
* @param User $user
|
* @param User $user
|
||||||
@@ -203,48 +244,15 @@ class TestData
|
|||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($user->accounts()->get() as $account) {
|
foreach ($user->accounts()->get() as $account) {
|
||||||
if ($account->name == $name) {
|
if ($account->name == $name) {
|
||||||
|
Log::debug('Trying to find "' . $name . '" in "' . $account->name . '", and found it!');
|
||||||
|
|
||||||
return $account;
|
return $account;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
Log::debug('Trying to find "' . $name . '" in "' . $account->name . '".');
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param User $user
|
|
||||||
*/
|
|
||||||
public static function createBills(User $user)
|
|
||||||
{
|
|
||||||
Bill::create(
|
|
||||||
[
|
|
||||||
'name' => 'Rent',
|
|
||||||
'match' => 'rent,land,lord',
|
|
||||||
'amount_min' => 795,
|
|
||||||
'amount_max' => 805,
|
|
||||||
'user_id' => $user->id,
|
|
||||||
'date' => '2015-01-01',
|
|
||||||
'active' => 1,
|
|
||||||
'automatch' => 1,
|
|
||||||
'repeat_freq' => 'monthly',
|
|
||||||
'skip' => 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
Bill::create(
|
|
||||||
[
|
|
||||||
'name' => 'Health insurance',
|
|
||||||
'match' => 'zilveren,kruis,health',
|
|
||||||
'amount_min' => 120,
|
|
||||||
'amount_max' => 140,
|
|
||||||
'user_id' => $user->id,
|
|
||||||
'date' => '2015-01-01',
|
|
||||||
'active' => 1,
|
|
||||||
'automatch' => 1,
|
|
||||||
'repeat_freq' => 'monthly',
|
|
||||||
'skip' => 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user