mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 00:20:03 +00:00
make sure randomly selected journals match prerequisites.
This commit is contained in:
@@ -36,8 +36,12 @@ class FromAccountContainsTest extends TestCase
|
||||
*/
|
||||
public function testTriggered()
|
||||
{
|
||||
$journal = TransactionJournal::find(20);
|
||||
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
$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;
|
||||
|
||||
$trigger = FromAccountContains::makeFromStrings($account->name, false);
|
||||
@@ -50,7 +54,7 @@ class FromAccountContainsTest extends TestCase
|
||||
*/
|
||||
public function testTriggeredNot()
|
||||
{
|
||||
$journal = TransactionJournal::find(21);
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
|
||||
$trigger = FromAccountContains::makeFromStrings('some name' . rand(1, 234), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
|
||||
Reference in New Issue
Block a user