Improve test coverage.

This commit is contained in:
James Cole
2019-08-01 06:21:44 +02:00
parent 9b574ce7ad
commit b049ca27f1
45 changed files with 336 additions and 251 deletions

View File

@@ -39,7 +39,7 @@ class SetNotesTest extends TestCase
public function testAct(): void
{
// give journal a note:
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$journal = $this->getRandomWithdrawal();
$note = $journal->notes()->first();
if (null === $note) {
$note = new Note;
@@ -51,7 +51,7 @@ class SetNotesTest extends TestCase
// fire the action:
$ruleAction = new RuleAction;
$ruleAction->action_value = 'These are new notes ' . random_int(1, 1234);
$ruleAction->action_value = 'These are new notes ' . $this->randomInt();
$action = new SetNotes($ruleAction);
$result = $action->act($journal);
$this->assertTrue($result);
@@ -68,13 +68,13 @@ class SetNotesTest extends TestCase
public function testActNoNotes(): void
{
// give journal a note:
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$journal = $this->getRandomWithdrawal();
$journal->notes()->forceDelete();
$this->assertEquals(0, $journal->notes()->count());
// fire the action:
$ruleAction = new RuleAction;
$ruleAction->action_value = 'These are new notes ' . random_int(1, 1234);
$ruleAction->action_value = 'These are new notes ' . $this->randomInt();
$action = new SetNotes($ruleAction);
$result = $action->act($journal);
$this->assertTrue($result);