Fix and expand tests for #2723

This commit is contained in:
James Cole
2019-12-26 11:06:38 +01:00
parent c23f16739c
commit fc8400cdf9
20 changed files with 200 additions and 59 deletions

View File

@@ -57,8 +57,7 @@ class FromAccountStartsTest extends TestCase
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
$trigger = FromAccountStarts::makeFromStrings(substr($account->name, 0, -3), false);
$result = $trigger->triggered($journal);
@@ -76,8 +75,7 @@ class FromAccountStartsTest extends TestCase
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
$trigger = FromAccountStarts::makeFromStrings('bla-bla-bla' . $account->name, false);
$result = $trigger->triggered($journal);
@@ -95,8 +93,7 @@ class FromAccountStartsTest extends TestCase
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalSourceAccounts')->once()->andReturn($collection);
$repository->shouldReceive('getSourceAccount')->once()->andReturn($account);
$trigger = FromAccountStarts::makeFromStrings('some name' . random_int(1, 234), false);
$result = $trigger->triggered($journal);