mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Improve test filter.
This commit is contained in:
@@ -36,13 +36,15 @@ class ToAccountIsTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testTriggered(): void
|
public function testTriggered(): void
|
||||||
{
|
{
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
$transactionCount = 0;
|
||||||
do {
|
do {
|
||||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||||
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
|
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
|
||||||
$account = $transaction->account;
|
$transactionCount = $journal->transactions()->count();
|
||||||
|
$account = $transaction->account;
|
||||||
$count++;
|
$count++;
|
||||||
} while ($account === null && $count < 30);
|
} while ($account === null && $count < 30 && $transactionCount !== 2);
|
||||||
|
|
||||||
$trigger = ToAccountIs::makeFromStrings($account->name, false);
|
$trigger = ToAccountIs::makeFromStrings($account->name, false);
|
||||||
$result = $trigger->triggered($journal);
|
$result = $trigger->triggered($journal);
|
||||||
@@ -54,13 +56,15 @@ class ToAccountIsTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testTriggeredNot(): void
|
public function testTriggeredNot(): void
|
||||||
{
|
{
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
$transactionCount = 0;
|
||||||
do {
|
do {
|
||||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||||
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
|
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
|
||||||
$account = $transaction->account;
|
$transactionCount = $journal->transactions()->count();
|
||||||
|
$account = $transaction->account;
|
||||||
$count++;
|
$count++;
|
||||||
} while ($account === null && $count < 30);
|
} while ($account === null && $count < 30 && $transactionCount !== 2);
|
||||||
|
|
||||||
$trigger = ToAccountIs::makeFromStrings('some name' . random_int(1, 234), false);
|
$trigger = ToAccountIs::makeFromStrings('some name' . random_int(1, 234), false);
|
||||||
$result = $trigger->triggered($journal);
|
$result = $trigger->triggered($journal);
|
||||||
|
Reference in New Issue
Block a user