mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 15:39:50 +00:00
Improve randomness in test data to prevent key collisions.
This commit is contained in:
@@ -59,7 +59,7 @@ class AddTagTest extends TestCase
|
||||
{
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$ruleAction = new RuleAction;
|
||||
$ruleAction->action_value = 'TestTag-' . random_int(1, 1000);
|
||||
$ruleAction->action_value = 'TestTag-' . random_int(1, 10000);
|
||||
$action = new AddTag($ruleAction);
|
||||
$result = $action->act($journal);
|
||||
$this->assertTrue($result);
|
||||
|
||||
@@ -39,7 +39,7 @@ class PrependDescriptionTest extends TestCase
|
||||
public function testAct(): void
|
||||
{
|
||||
// get journal, give fixed description
|
||||
$description = 'text' . random_int(1, 1000);
|
||||
$description = 'text' . random_int(1, 10000);
|
||||
$prepend = 'prepend' . random_int(1, 1234);
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$journal->description = $description;
|
||||
|
||||
@@ -39,7 +39,7 @@ class SetDescriptionTest extends TestCase
|
||||
public function testAct(): void
|
||||
{
|
||||
// get journal, give fixed description
|
||||
$description = 'text' . random_int(1, 1000);
|
||||
$description = 'text' . random_int(1, 10000);
|
||||
$newDescription = 'new description' . random_int(1, 1234);
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$journal->description = $description;
|
||||
|
||||
@@ -103,7 +103,7 @@ class SetDestinationAccountTest extends TestCase
|
||||
|
||||
// fire the action:
|
||||
$ruleAction = new RuleAction;
|
||||
$ruleAction->action_value = 'Not existing asset account #' . random_int(1, 1000);
|
||||
$ruleAction->action_value = 'Not existing asset account #' . random_int(1, 10000);
|
||||
$action = new SetDestinationAccount($ruleAction);
|
||||
$result = $action->act($journal);
|
||||
$this->assertFalse($result);
|
||||
@@ -134,7 +134,7 @@ class SetDestinationAccountTest extends TestCase
|
||||
|
||||
// fire the action:
|
||||
$ruleAction = new RuleAction;
|
||||
$ruleAction->action_value = 'Not existing expense account #' . random_int(1, 1000);
|
||||
$ruleAction->action_value = 'Not existing expense account #' . random_int(1, 10000);
|
||||
$action = new SetDestinationAccount($ruleAction);
|
||||
$result = $action->act($journal);
|
||||
|
||||
@@ -202,7 +202,7 @@ class SetDestinationAccountTest extends TestCase
|
||||
|
||||
// fire the action:
|
||||
$ruleAction = new RuleAction;
|
||||
$ruleAction->action_value = 'Some new asset ' . random_int(1, 1000);
|
||||
$ruleAction->action_value = 'Some new asset ' . random_int(1, 10000);
|
||||
$action = new SetDestinationAccount($ruleAction);
|
||||
$result = $action->act($journal);
|
||||
$this->assertFalse($result);
|
||||
|
||||
@@ -104,7 +104,7 @@ class SetSourceAccountTest extends TestCase
|
||||
|
||||
// fire the action:
|
||||
$ruleAction = new RuleAction;
|
||||
$ruleAction->action_value = 'Some new revenue #' . random_int(1, 1000);
|
||||
$ruleAction->action_value = 'Some new revenue #' . random_int(1, 10000);
|
||||
$action = new SetSourceAccount($ruleAction);
|
||||
$result = $action->act($journal);
|
||||
$this->assertTrue($result);
|
||||
@@ -173,7 +173,7 @@ class SetSourceAccountTest extends TestCase
|
||||
|
||||
// fire the action:
|
||||
$ruleAction = new RuleAction;
|
||||
$ruleAction->action_value = 'Some new account #' . random_int(1, 1000);
|
||||
$ruleAction->action_value = 'Some new account #' . random_int(1, 10000);
|
||||
$action = new SetSourceAccount($ruleAction);
|
||||
$result = $action->act($journal);
|
||||
$this->assertFalse($result);
|
||||
@@ -196,7 +196,7 @@ class SetSourceAccountTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
// fire the action:
|
||||
$ruleAction = new RuleAction;
|
||||
$ruleAction->action_value = 'Some new asset ' . random_int(1, 1000);
|
||||
$ruleAction->action_value = 'Some new asset ' . random_int(1, 10000);
|
||||
$action = new SetSourceAccount($ruleAction);
|
||||
$result = $action->act($journal);
|
||||
$this->assertFalse($result);
|
||||
|
||||
Reference in New Issue
Block a user