mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-04 04:24:26 +00:00
Improve randomness in test data to prevent key collisions.
This commit is contained in:
@@ -40,7 +40,7 @@ class AccountDestroyServiceTest extends TestCase
|
||||
public function testDestroyBasic(): void
|
||||
{
|
||||
$account = Account::create(
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 1000),
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 10000),
|
||||
'virtual_balance' => '0', 'iban' => null, 'active' => true]
|
||||
);
|
||||
/** @var AccountDestroyService $service */
|
||||
@@ -57,7 +57,7 @@ class AccountDestroyServiceTest extends TestCase
|
||||
{
|
||||
// create objects:
|
||||
$account = Account::create(
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 1000),
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 10000),
|
||||
'virtual_balance' => '0', 'iban' => null, 'active' => true]
|
||||
);
|
||||
Transaction::create(['account_id' => $account->id, 'transaction_journal_id' => 1, 'amount' => 10, 'transaction_currency_id' => 1]);
|
||||
@@ -79,11 +79,11 @@ class AccountDestroyServiceTest extends TestCase
|
||||
public function testDestroyMove(): void
|
||||
{
|
||||
$account = Account::create(
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 1000),
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 10000),
|
||||
'virtual_balance' => '0', 'iban' => null, 'active' => true]
|
||||
);
|
||||
$move = Account::create(
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 1000),
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 10000),
|
||||
'virtual_balance' => '0', 'iban' => null, 'active' => true]
|
||||
);
|
||||
$transaction = Transaction::create(['account_id' => $account->id, 'transaction_journal_id' => 1, 'amount' => 10, 'transaction_currency_id' => 1]);
|
||||
|
||||
@@ -46,7 +46,7 @@ class AccountUpdateServiceTest extends TestCase
|
||||
{
|
||||
/** @var Account $account */
|
||||
$account = Account::create(
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 1000),
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 10000),
|
||||
'virtual_balance' => '0', 'iban' => null, 'active' => true]
|
||||
);
|
||||
$opposing = $this->user()->accounts()->first();
|
||||
@@ -67,7 +67,7 @@ class AccountUpdateServiceTest extends TestCase
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'Some new name #' . random_int(1, 1000),
|
||||
'name' => 'Some new name #' . random_int(1, 10000),
|
||||
'active' => true,
|
||||
'virtualBalance' => '0',
|
||||
'iban' => null,
|
||||
@@ -96,7 +96,7 @@ class AccountUpdateServiceTest extends TestCase
|
||||
/** @var Account $account */
|
||||
$account = $this->user()->accounts()->first();
|
||||
$data = [
|
||||
'name' => 'Some new name #' . random_int(1, 1000),
|
||||
'name' => 'Some new name #' . random_int(1, 10000),
|
||||
'active' => true,
|
||||
'virtualBalance' => '0',
|
||||
'iban' => null,
|
||||
@@ -119,7 +119,7 @@ class AccountUpdateServiceTest extends TestCase
|
||||
/** @var Account $account */
|
||||
$account = $this->user()->accounts()->first();
|
||||
$data = [
|
||||
'name' => 'Some new name #' . random_int(1, 1000),
|
||||
'name' => 'Some new name #' . random_int(1, 10000),
|
||||
'active' => true,
|
||||
'virtualBalance' => '0',
|
||||
'iban' => null,
|
||||
@@ -149,7 +149,7 @@ class AccountUpdateServiceTest extends TestCase
|
||||
$note->save();
|
||||
|
||||
$data = [
|
||||
'name' => 'Some new name #' . random_int(1, 1000),
|
||||
'name' => 'Some new name #' . random_int(1, 10000),
|
||||
'active' => true,
|
||||
'virtualBalance' => '0',
|
||||
'iban' => null,
|
||||
@@ -174,7 +174,7 @@ class AccountUpdateServiceTest extends TestCase
|
||||
{
|
||||
/** @var Account $account */
|
||||
$account = Account::create(
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 1000),
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 10000),
|
||||
'virtual_balance' => '0', 'iban' => null, 'active' => true]
|
||||
);
|
||||
$opposing = $this->user()->accounts()->first();
|
||||
@@ -195,7 +195,7 @@ class AccountUpdateServiceTest extends TestCase
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'Some new name #' . random_int(1, 1000),
|
||||
'name' => 'Some new name #' . random_int(1, 10000),
|
||||
'active' => true,
|
||||
'virtualBalance' => '0',
|
||||
'iban' => null,
|
||||
@@ -229,7 +229,7 @@ class AccountUpdateServiceTest extends TestCase
|
||||
|
||||
/** @var Account $account */
|
||||
$account = Account::create(
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 1000),
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 10000),
|
||||
'virtual_balance' => '0', 'iban' => null, 'active' => true]
|
||||
);
|
||||
$opposing = $this->user()->accounts()->first();
|
||||
@@ -250,7 +250,7 @@ class AccountUpdateServiceTest extends TestCase
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'Some new name #' . random_int(1, 1000),
|
||||
'name' => 'Some new name #' . random_int(1, 10000),
|
||||
'active' => true,
|
||||
'virtualBalance' => '0',
|
||||
'iban' => null,
|
||||
@@ -281,11 +281,11 @@ class AccountUpdateServiceTest extends TestCase
|
||||
{
|
||||
/** @var Account $account */
|
||||
$account = Account::create(
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 1000),
|
||||
['user_id' => $this->user()->id, 'account_type_id' => 1, 'name' => 'Some name #' . random_int(1, 10000),
|
||||
'virtual_balance' => '0', 'iban' => null, 'active' => true]
|
||||
);
|
||||
$data = [
|
||||
'name' => 'Some new name #' . random_int(1, 1000),
|
||||
'name' => 'Some new name #' . random_int(1, 10000),
|
||||
'active' => true,
|
||||
'virtualBalance' => '0',
|
||||
'iban' => null,
|
||||
|
||||
@@ -65,7 +65,7 @@ class JournalUpdateServiceTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->where('transaction_type_id', 2)->first();
|
||||
$data = [
|
||||
'description' => 'Updated journal #' . random_int(1, 1000),
|
||||
'description' => 'Updated journal #' . random_int(1, 10000),
|
||||
'date' => new Carbon('2018-01-01'),
|
||||
'bill_id' => null,
|
||||
'bill_name' => null,
|
||||
@@ -107,7 +107,7 @@ class JournalUpdateServiceTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 2)->first();
|
||||
$data = [
|
||||
'description' => 'Updated journal #' . random_int(1, 1000),
|
||||
'description' => 'Updated journal #' . random_int(1, 10000),
|
||||
'date' => new Carbon('2018-01-01'),
|
||||
'bill_id' => null,
|
||||
'bill_name' => null,
|
||||
@@ -199,7 +199,7 @@ class JournalUpdateServiceTest extends TestCase
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->skip(4)->where('transaction_type_id', 1)->first();
|
||||
$data = [
|
||||
'description' => 'Updated journal #' . random_int(1, 1000),
|
||||
'description' => 'Updated journal #' . random_int(1, 10000),
|
||||
'date' => new Carbon('2018-01-01'),
|
||||
'bill_id' => null,
|
||||
'bill_name' => null,
|
||||
|
||||
Reference in New Issue
Block a user