Files
firefly-iii/database/factories/ModelFactory.php

252 lines
8.6 KiB
PHP
Raw Normal View History

<?php
2017-12-10 09:02:26 +01:00
/**
* ModelFactory.php
2020-03-17 16:06:30 +00:00
* Copyright (c) 2019 james@firefly-iii.org.
2017-12-10 09:02:26 +01:00
*
* This file is part of Firefly III (https://github.com/firefly-iii).
2017-12-10 09:02:26 +01:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
2017-12-10 09:02:26 +01:00
*
* This program is distributed in the hope that it will be useful,
2017-12-10 09:02:26 +01:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
2017-12-10 09:02:26 +01:00
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2017-12-10 09:02:26 +01:00
*/
2017-03-25 13:41:17 +01:00
declare(strict_types=1);
use Carbon\Carbon;
2019-08-17 10:47:51 +02:00
use FireflyIII\Models\TransactionJournal;
2017-03-25 13:41:17 +01:00
2018-07-01 18:31:02 +02:00
$factory->define(
FireflyIII\Models\Attachment::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2018-07-01 18:31:02 +02:00
return [
'user_id' => 1,
'attachable_id' => 1,
2019-08-17 10:47:51 +02:00
'attachable_type' => TransactionJournal::class,
2018-07-01 18:31:02 +02:00
'md5' => md5($faker->words(6, true)),
'mime' => 'text/plain',
'size' => 1,
'filename' => 'ok',
'uploaded' => true,
];
}
);
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\CurrencyExchangeRate::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2017-11-22 21:12:27 +01:00
'user_id' => 1,
'from_currency_id' => 1,
'to_currency_id' => 2,
'date' => '2017-01-01',
'rate' => '1.5',
'user_rate' => null,
];
2017-11-15 10:53:17 +01:00
}
);
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\TransactionCurrency::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2017-11-22 21:12:27 +01:00
'name' => $faker->words(1, true),
'code' => 'ABC',
'symbol' => 'x',
];
2017-11-15 10:53:17 +01:00
}
);
2017-03-18 11:02:02 +01:00
2017-03-19 17:54:21 +01:00
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\ImportJob::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2017-11-22 21:12:27 +01:00
'id' => $faker->numberBetween(1, 100),
'user_id' => 1,
'key' => $faker->words(1, true),
'file_type' => 'csv',
'status' => 'import_status_never_started',
'configuration' => null,
'extended_status' => [
'total_steps' => 0,
'steps_done' => 0,
'import_count' => 0,
'importTag' => 0,
'errors' => [],
],
];
2017-11-15 10:53:17 +01:00
}
2017-03-19 17:54:21 +01:00
);
2017-03-18 11:02:02 +01:00
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\TransactionJournal::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2017-11-22 21:12:27 +01:00
'id' => $faker->unique()->numberBetween(1000, 10000),
'user_id' => 1,
'transaction_type_id' => 1,
'bill_id' => null,
'transaction_currency_id' => 1,
'description' => $faker->words(3, true),
'date' => '2017-01-01',
'interest_date' => null,
'book_date' => null,
'process_date' => null,
'order' => 0,
'tag_count' => 0,
'encrypted' => 0,
'completed' => 1,
];
2017-11-15 10:53:17 +01:00
}
2017-03-18 11:02:02 +01:00
);
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\Bill::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2018-04-14 21:21:20 +02:00
'created_at' => new Carbon,
'updated_at' => new Carbon,
'user_id' => 1,
'transaction_currency_id' => 1,
'name' => $faker->words(3, true),
'match' => $faker->words(3, true),
'amount_min' => '100.00',
'amount_max' => '100.00',
'date' => '2017-01-01',
'repeat_freq' => 'monthly',
'skip' => 0,
'automatch' => 1,
2017-11-22 21:12:27 +01:00
];
2017-11-15 10:53:17 +01:00
}
2017-03-18 11:02:02 +01:00
);
2017-04-28 07:51:09 +02:00
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\PiggyBankRepetition::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2017-11-22 21:12:27 +01:00
'id' => $faker->unique()->numberBetween(100, 10000),
'piggy_bank_id' => $faker->numberBetween(1, 10),
'startdate' => '2017-01-01',
'targetdate' => '2020-01-01',
'currentamount' => 10,
];
2017-11-15 10:53:17 +01:00
}
2017-04-28 07:51:09 +02:00
);
2017-03-17 16:34:57 +01:00
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\PiggyBank::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2017-11-22 21:12:27 +01:00
'id' => $faker->unique()->numberBetween(100, 10000),
2018-04-27 11:29:09 +02:00
'created_at' => new Carbon,
'updated_at' => new Carbon,
2017-11-22 21:12:27 +01:00
'account_id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
'target_amount' => '1000.00',
2018-04-27 11:29:09 +02:00
'startdate' => new Carbon('2017-01-01'),
2017-11-22 21:12:27 +01:00
'order' => 1,
'active' => 1,
'encrypted' => 0,
];
2017-11-15 10:53:17 +01:00
}
2017-03-17 16:34:57 +01:00
);
2017-03-05 13:21:36 +01:00
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\Tag::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2017-11-22 21:12:27 +01:00
'id' => $faker->unique()->numberBetween(200, 10000),
'user_id' => 1,
'tagMode' => 'nothing',
'tag' => $faker->words(1, true),
];
2017-11-15 10:53:17 +01:00
}
2017-03-05 13:21:36 +01:00
);
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\Category::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2017-11-22 21:12:27 +01:00
'id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
];
2017-11-15 10:53:17 +01:00
}
2017-03-05 13:21:36 +01:00
);
2017-03-05 11:18:34 +01:00
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\Budget::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2017-11-22 21:12:27 +01:00
'id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
];
2017-11-15 10:53:17 +01:00
}
2017-03-05 11:18:34 +01:00
);
2017-03-12 09:22:33 +01:00
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\PiggyBankEvent::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2017-11-22 21:12:27 +01:00
'id' => $faker->numberBetween(1, 10),
'piggy_bank_id' => $faker->numberBetween(1, 10),
'transaction_journal_id' => $faker->numberBetween(1, 10),
'date' => $faker->date('Y-m-d'),
'amount' => '100',
];
2017-11-15 10:53:17 +01:00
}
2017-03-12 09:22:33 +01:00
);
2017-03-12 08:38:13 +01:00
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\BudgetLimit::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2017-11-22 21:12:27 +01:00
'id' => $faker->numberBetween(1, 10),
'start_date' => '2017-01-01',
'end_date' => '2017-01-31',
'amount' => '300',
'budget_id' => $faker->numberBetween(1, 6),
];
2017-11-15 10:53:17 +01:00
}
2017-03-12 08:38:13 +01:00
);
2017-03-04 11:20:57 +01:00
$factory->define(
2017-11-15 10:53:17 +01:00
FireflyIII\Models\Transaction::class,
2020-03-17 16:06:30 +00:00
static function (Faker\Generator $faker) {
2017-11-15 10:53:17 +01:00
return [
2018-04-02 14:17:11 +02:00
'transaction_amount' => (string)$faker->randomFloat(2, -100, 100),
'destination_amount' => (string)$faker->randomFloat(2, -100, 100),
2017-11-22 21:12:27 +01:00
'opposing_account_id' => $faker->numberBetween(1, 10),
2018-07-01 18:31:02 +02:00
'source_id' => $faker->numberBetween(1, 10),
2017-11-22 21:12:27 +01:00
'opposing_account_name' => $faker->words(3, true),
'description' => $faker->words(3, true),
2018-07-01 18:31:02 +02:00
'source_name' => $faker->words(3, true),
'destination_id' => $faker->numberBetween(1, 10),
2017-11-22 21:12:27 +01:00
'date' => new Carbon,
2018-07-01 18:31:02 +02:00
'destination_name' => $faker->words(3, true),
2018-04-02 14:17:11 +02:00
'amount' => (string)$faker->randomFloat(2, -100, 100),
2017-11-22 21:12:27 +01:00
'budget_id' => 0,
'category' => $faker->words(3, true),
'transaction_journal_id' => $faker->numberBetween(1, 10),
'journal_id' => $faker->numberBetween(1, 10),
'transaction_currency_code' => 'EUR',
'transaction_type_type' => 'Withdrawal',
'account_encrypted' => 0,
'account_name' => 'Some name',
'transaction_currency_id' => 1,
'transaction_currency_symbol' => '€',
'foreign_destination_amount' => null,
'foreign_currency_id' => null,
'foreign_currency_code' => null,
'foreign_currency_symbol' => null,
];
2017-11-15 10:53:17 +01:00
}
2017-07-07 08:09:42 +02:00
);