Improve test coverage.

This commit is contained in:
James Cole
2019-07-31 16:53:09 +02:00
parent 5524941c90
commit 9b574ce7ad
155 changed files with 1890 additions and 2263 deletions

View File

@@ -75,7 +75,7 @@ class AddTagTest extends TestCase
*/
public function testActNoTag(): void
{
$newTagName = 'TestTag-' . random_int(1, 10000);
$newTagName = 'TestTag-' . $th;
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$ruleAction = new RuleAction;
$ruleAction->action_value = $newTagName;

View File

@@ -59,7 +59,7 @@ class ConvertToDepositTest extends TestCase
return;
$revenue = $this->getRandomRevenue();
$name = 'Random revenue #' . random_int(1, 10000);
$name = 'Random revenue #' . $this->randomInt();
$journal = $this->getRandomTransfer();
// journal is a transfer:
@@ -98,7 +98,7 @@ class ConvertToDepositTest extends TestCase
return;
$revenue = $this->getRandomRevenue();
$name = 'Random revenue #' . random_int(1, 10000);
$name = 'Random revenue #' . $this->randomInt();
$journal = $this->getRandomWithdrawal();
// journal is a withdrawal:

View File

@@ -59,7 +59,7 @@ class ConvertToWithdrawalTest extends TestCase
return;
$expense = $this->getRandomExpense();
$name = 'Random expense #' . random_int(1, 10000);
$name = 'Random expense #' . $this->randomInt();
$deposit = $this->getRandomDeposit();
// journal is a deposit:
@@ -98,7 +98,7 @@ class ConvertToWithdrawalTest extends TestCase
return;
$expense = $this->getRandomExpense();
$name = 'Random expense #' . random_int(1, 10000);
$name = 'Random expense #' . $this->randomInt();
$transfer = $this->getRandomTransfer();
// journal is a transfer:

View File

@@ -38,7 +38,7 @@ class PrependDescriptionTest extends TestCase
public function testAct(): void
{
// get journal, give fixed description
$description = 'text' . random_int(1, 10000);
$description = 'text' . $this->randomInt();
$prepend = 'prepend' . random_int(1, 1234);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$journal->description = $description;

View File

@@ -38,7 +38,7 @@ class SetDescriptionTest extends TestCase
public function testAct(): void
{
// get journal, give fixed description
$description = 'text' . random_int(1, 10000);
$description = 'text' . $this->randomInt();
$newDescription = 'new description' . random_int(1, 1234);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$journal->description = $description;

View File

@@ -94,7 +94,7 @@ class SetDestinationAccountTest extends TestCase
// fire the action:
$ruleAction = new RuleAction;
$ruleAction->action_value = 'Not existing asset account #' . random_int(1, 10000);
$ruleAction->action_value = 'Not existing asset account #' . $this->randomInt();
$action = new SetDestinationAccount($ruleAction);
$result = $action->act($deposit);
$this->assertFalse($result);
@@ -121,7 +121,7 @@ class SetDestinationAccountTest extends TestCase
// fire the action:
$ruleAction = new RuleAction;
$ruleAction->action_value = 'Not existing expense account #' . random_int(1, 10000);
$ruleAction->action_value = 'Not existing expense account #' . $this->randomInt();
$action = new SetDestinationAccount($ruleAction);
$result = $action->act($withdrawal);
@@ -186,7 +186,7 @@ class SetDestinationAccountTest extends TestCase
// fire the action:
$ruleAction = new RuleAction;
$ruleAction->action_value = 'Some new asset ' . random_int(1, 10000);
$ruleAction->action_value = 'Some new asset ' . $this->randomInt();
$action = new SetDestinationAccount($ruleAction);
$result = $action->act($journal);
$this->assertFalse($result);

View File

@@ -93,7 +93,7 @@ class SetSourceAccountTest extends TestCase
// fire the action:
$ruleAction = new RuleAction;
$ruleAction->action_value = 'Some new revenue #' . random_int(1, 10000);
$ruleAction->action_value = 'Some new revenue #' . $this->randomInt();
$action = new SetSourceAccount($ruleAction);
$result = $action->act($deposit);
$this->assertTrue($result);
@@ -155,7 +155,7 @@ class SetSourceAccountTest extends TestCase
// fire the action:
$ruleAction = new RuleAction;
$ruleAction->action_value = 'Some new account #' . random_int(1, 10000);
$ruleAction->action_value = 'Some new account #' . $this->randomInt();
$action = new SetSourceAccount($ruleAction);
$result = $action->act($withdrawal);
$this->assertFalse($result);
@@ -181,7 +181,7 @@ class SetSourceAccountTest extends TestCase
$accountRepos->shouldReceive('setUser');
// fire the action:
$ruleAction = new RuleAction;
$ruleAction->action_value = 'Some new asset ' . random_int(1, 10000);
$ruleAction->action_value = 'Some new asset ' . $this->randomInt();
$action = new SetSourceAccount($ruleAction);
$result = $action->act($journal);
$this->assertFalse($result);