Various bugfixes and code clean up.

This commit is contained in:
James Cole
2018-07-27 04:46:21 +02:00
parent 2ad8e7f343
commit 0312ba8ad7
60 changed files with 223 additions and 353 deletions

View File

@@ -25,6 +25,7 @@ namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\FromAccountContains;
use Illuminate\Support\Collection;
use Tests\TestCase;
/**
@@ -38,13 +39,12 @@ class FromAccountContainsTest extends TestCase
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$count = 0;
while ($count === 0) {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$count = $journal->transactions()->where('amount', '<', 0)->count();
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
}
$account = $transaction->account;
/** @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);
$trigger = FromAccountContains::makeFromStrings($account->name, false);
$result = $trigger->triggered($journal);
@@ -57,7 +57,12 @@ class FromAccountContainsTest extends TestCase
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
/** @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);
$trigger = FromAccountContains::makeFromStrings('some name' . random_int(1, 234), false);
$result = $trigger->triggered($journal);
@@ -70,8 +75,8 @@ class FromAccountContainsTest extends TestCase
public function testWillMatchEverythingEmpty(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = '';
$result = FromAccountContains::willMatchEverything($value);
$value = '';
$result = FromAccountContains::willMatchEverything($value);
$this->assertTrue($result);
}
@@ -81,8 +86,8 @@ class FromAccountContainsTest extends TestCase
public function testWillMatchEverythingNotNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = 'x';
$result = FromAccountContains::willMatchEverything($value);
$value = 'x';
$result = FromAccountContains::willMatchEverything($value);
$this->assertFalse($result);
}
@@ -92,8 +97,8 @@ class FromAccountContainsTest extends TestCase
public function testWillMatchEverythingNull(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$value = null;
$result = FromAccountContains::willMatchEverything($value);
$value = null;
$result = FromAccountContains::willMatchEverything($value);
$this->assertTrue($result);
}
}

View File

@@ -25,6 +25,7 @@ namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\FromAccountEnds;
use Illuminate\Support\Collection;
use Tests\TestCase;
/**
@@ -38,13 +39,11 @@ class FromAccountEndsTest extends TestCase
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$count = 0;
while ($count === 0) {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$count = $journal->transactions()->where('amount', '<', 0)->count();
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
}
$account = $transaction->account;
/** @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);
$trigger = FromAccountEnds::makeFromStrings(substr($account->name, -3), false);
$result = $trigger->triggered($journal);
@@ -57,13 +56,12 @@ class FromAccountEndsTest extends TestCase
public function testTriggeredLonger(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$count = 0;
while ($count === 0) {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$count = $journal->transactions()->where('amount', '<', 0)->count();
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
}
$account = $transaction->account;
/** @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);
$trigger = FromAccountEnds::makeFromStrings('bla-bla-bla' . $account->name, false);
$result = $trigger->triggered($journal);
@@ -76,7 +74,12 @@ class FromAccountEndsTest extends TestCase
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
/** @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);
$trigger = FromAccountEnds::makeFromStrings('some name' . random_int(1, 234), false);
$result = $trigger->triggered($journal);

View File

@@ -25,6 +25,7 @@ namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\FromAccountIs;
use Illuminate\Support\Collection;
use Tests\TestCase;
use Log;
/**
@@ -38,20 +39,12 @@ class FromAccountIsTest extends TestCase
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
$account = null === $transaction ? null : $transaction->account;
$count = $journal->transactions()->count();
Log::debug(sprintf('Loop: %d, transaction count: %d, account is null: %d', $loops, $count, (int)null===$account));
$loops++;
// do this until: account is not null, journal has two transactions, loops is below 30
} while (!(null !== $account && 2 === $count && $loops < 30));
/** @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);
$trigger = FromAccountIs::makeFromStrings($account->name, false);
@@ -65,7 +58,12 @@ class FromAccountIsTest extends TestCase
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
/** @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);
$trigger = FromAccountIs::makeFromStrings('some name' . random_int(1, 234), false);
$result = $trigger->triggered($journal);

View File

@@ -25,6 +25,7 @@ namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\FromAccountStarts;
use Illuminate\Support\Collection;
use Log;
use Tests\TestCase;
@@ -48,26 +49,12 @@ class FromAccountStartsTest extends TestCase
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
Log::debug('In testTriggered()');
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
$account = null === $transaction ? null : $transaction->account;
$count = $journal->transactions()->count();
$name = $account->name ?? '';
Log::debug(sprintf('Loop: %d, transaction count: %d, account is null: %d, name = "%s"', $loops, $count, (int)null === $account, $name));
$loops++;
// do this while the following is untrue:
// 1) account is not null,
// 2) journal has two transactions
// 3) loops is less than 30
// 4) $name is longer than 3
} while (!(null !== $account && 2 === $count && $loops < 30 && \strlen($name) > 3));
/** @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);
$trigger = FromAccountStarts::makeFromStrings(substr($account->name, 0, -3), false);
$result = $trigger->triggered($journal);
@@ -80,26 +67,12 @@ class FromAccountStartsTest extends TestCase
public function testTriggeredLonger(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
Log::debug('In testTriggeredLonger()');
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
$account = null === $transaction ? null : $transaction->account;
$count = $journal->transactions()->count();
$name = $account->name ?? '';
Log::debug(sprintf('Loop: %d, transaction count: %d, account is null: %d, name = "%s"', $loops, $count, (int)null === $account, $name));
$loops++;
// do this while the following is untrue:
// 1) account is not null,
// 2) journal has two transactions
// 3) loops is less than 30
// 4) $name is longer than 3
} while (!(null !== $account && 2 === $count && $loops < 30 && \strlen($name) > 3));
/** @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);
$trigger = FromAccountStarts::makeFromStrings('bla-bla-bla' . $account->name, false);
$result = $trigger->triggered($journal);
@@ -112,7 +85,12 @@ class FromAccountStartsTest extends TestCase
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
/** @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);
$trigger = FromAccountStarts::makeFromStrings('some name' . random_int(1, 234), false);
$result = $trigger->triggered($journal);

View File

@@ -25,6 +25,7 @@ namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\ToAccountContains;
use Illuminate\Support\Collection;
use Tests\TestCase;
/**
@@ -39,14 +40,11 @@ class ToAccountContainsTest extends TestCase
{
$repository = $this->mock(JournalRepositoryInterface::class);
$count = 0;
do {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
$transactionCount = $journal->transactions()->count();
$account = null === $transaction ? null : $transaction->account;
$count++;
} while ($account === null && $count < 30 && $transactionCount !== 2);
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
$trigger = ToAccountContains::makeFromStrings($account->name, false);
@@ -60,14 +58,12 @@ class ToAccountContainsTest extends TestCase
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$count = 0;
do {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
$transactionCount = $journal->transactions()->count();
$account = null === $transaction ? null : $transaction->account;
$count++;
} while ($account === null && $count < 30 && $transactionCount !== 2);
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
$trigger = ToAccountContains::makeFromStrings('some name' . random_int(1, 234), false);

View File

@@ -25,6 +25,7 @@ namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\ToAccountEnds;
use Illuminate\Support\Collection;
use Log;
use Tests\TestCase;
@@ -39,26 +40,12 @@ class ToAccountEndsTest extends TestCase
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
$account = null === $transaction ? null : $transaction->account;
$count = $journal->transactions()->count();
$name = $account->name ?? '';
Log::debug(sprintf('Loop: %d, transaction count: %d, account is null: %d, name = "%s"', $loops, $count, (int)null === $account, $name));
$loops++;
// do this while the following is untrue:
// 1) account is not null,
// 2) journal has two transactions
// 3) loops is less than 30
// 4) $name is longer than 3
} while (!(null !== $account && 2 === $count && $loops < 30 && \strlen($name) > 3));
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
$trigger = ToAccountEnds::makeFromStrings(substr($account->name, -3), false);
$result = $trigger->triggered($journal);
@@ -71,25 +58,12 @@ class ToAccountEndsTest extends TestCase
public function testTriggeredLonger(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
$account = null === $transaction ? null : $transaction->account;
$count = $journal->transactions()->count();
$name = $account->name ?? '';
Log::debug(sprintf('Loop: %d, transaction count: %d, account is null: %d, name = "%s"', $loops, $count, (int)null === $account, $name));
$loops++;
// do this while the following is untrue:
// 1) account is not null,
// 2) journal has two transactions
// 3) loops is less than 30
// 4) $name is longer than 3
} while (!(null !== $account && 2 === $count && $loops < 30 && \strlen($name) > 3));
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
$trigger = ToAccountEnds::makeFromStrings('bla-bla-bla' . $account->name, false);
$result = $trigger->triggered($journal);
@@ -102,25 +76,12 @@ class ToAccountEndsTest extends TestCase
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
$account = null === $transaction ? null : $transaction->account;
$count = $journal->transactions()->count();
$name = $account->name ?? '';
Log::debug(sprintf('Loop: %d, transaction count: %d, account is null: %d, name = "%s"', $loops, $count, (int)null === $account, $name));
$loops++;
// do this while the following is untrue:
// 1) account is not null,
// 2) journal has two transactions
// 3) loops is less than 30
// 4) $name is longer than 3
} while (!(null !== $account && 2 === $count && $loops < 30 && \strlen($name) > 3));
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
$trigger = ToAccountEnds::makeFromStrings((string)random_int(1, 1234), false);
$result = $trigger->triggered($journal);

View File

@@ -25,6 +25,7 @@ namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\ToAccountIs;
use Illuminate\Support\Collection;
use Tests\TestCase;
use Log;
@@ -39,20 +40,12 @@ class ToAccountIsTest extends TestCase
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
$account = null === $transaction ? null : $transaction->account;
$count = $journal->transactions()->count();
Log::debug(sprintf('Loop: %d, transaction count: %d, account is null: %d', $loops, $count, (int)null===$account));
$loops++;
// do this until: account is not null, journal has two transactions, loops is below 30
} while (!(null !== $account && 2 === $count && $loops < 30));
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
@@ -67,20 +60,12 @@ class ToAccountIsTest extends TestCase
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
$account = null === $transaction ? null : $transaction->account;
$count = $journal->transactions()->count();
Log::debug(sprintf('Loop: %d, transaction count: %d, account is null: %d', $loops, $count, (int)null===$account));
$loops++;
// do this until: account is not null, journal has two transactions, loops is below 30
} while (!(null !== $account && 2 === $count && $loops < 30));
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
$trigger = ToAccountIs::makeFromStrings('some name' . random_int(1, 234), false);
$result = $trigger->triggered($journal);

View File

@@ -25,6 +25,7 @@ namespace Tests\Unit\TransactionRules\Triggers;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\TransactionRules\Triggers\ToAccountStarts;
use Illuminate\Support\Collection;
use Log;
use Tests\TestCase;
@@ -39,22 +40,12 @@ class ToAccountStartsTest extends TestCase
public function testTriggered(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
Log::debug('Now in testTriggered');
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
$account = null === $transaction ? null : $transaction->account;
$count = $journal->transactions()->count();
Log::debug(sprintf('Loop: %d, transaction count: %d, account is null: %d', $loops, $count, (int)null === $account));
$loops++;
// do this until: account is not null, journal has two transactions, loops is below 30
} while (!(null !== $account && 2 === $count && $loops < 30));
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
$trigger = ToAccountStarts::makeFromStrings(substr($account->name, 0, -3), false);
@@ -68,23 +59,12 @@ class ToAccountStartsTest extends TestCase
public function testTriggeredLonger(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
Log::debug('Now in testTriggeredLonger');
$loops = 0; // FINAL LOOP METHOD.
do {
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->whereNull('deleted_at')->first();
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
$account = null === $transaction ? null : $transaction->account;
$count = $journal->transactions()->count();
Log::debug(sprintf('Loop: %d, transaction count: %d, account is null: %d', $loops, $count, (int)null === $account));
$loops++;
// do this until: account is not null, journal has two transactions, loops is below 30
} while (!(null !== $account && 2 === $count && $loops < 30));
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
$trigger = ToAccountStarts::makeFromStrings('bla-bla-bla' . $account->name, false);
$result = $trigger->triggered($journal);
@@ -97,7 +77,12 @@ class ToAccountStartsTest extends TestCase
public function testTriggeredNot(): void
{
$repository = $this->mock(JournalRepositoryInterface::class);
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
/** @var TransactionJournal $journal */
$journal = $this->user()->transactionJournals()->inRandomOrder()->first();
$account = $this->user()->accounts()->inRandomOrder()->first();
$collection = new Collection([$account]);
$repository->shouldReceive('getJournalDestinationAccounts')->once()->andReturn($collection);
$trigger = ToAccountStarts::makeFromStrings('some name' . random_int(1, 234), false);
$result = $trigger->triggered($journal);