mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
make sure randomly selected journals match prerequisites.
This commit is contained in:
@@ -1321,10 +1321,15 @@ class TransactionControllerTest extends TestCase
|
||||
*/
|
||||
public function testShowDeposit()
|
||||
{
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->where('transaction_type_id', 2)->first();
|
||||
do {
|
||||
// this is kind of cheating but OK.
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 2)->whereNull('deleted_at')->first();
|
||||
$count = $journal->transactions()->count();
|
||||
} while ($count !== 2);
|
||||
$transaction = $journal->transactions()->first();
|
||||
|
||||
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsByType')
|
||||
@@ -1381,8 +1386,12 @@ class TransactionControllerTest extends TestCase
|
||||
*/
|
||||
public function testShowWithdrawal()
|
||||
{
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->where('transaction_type_id', 1)->first();
|
||||
do {
|
||||
// this is kind of cheating but OK.
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 1)->whereNull('deleted_at')->first();
|
||||
$count = $journal->transactions()->count();
|
||||
} while ($count !== 2);
|
||||
$transaction = $journal->transactions()->first();
|
||||
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
|
Reference in New Issue
Block a user