mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-05-04 21:23:36 +00:00
Improve test coverage.
This commit is contained in:
@@ -137,17 +137,12 @@ class JournalUpdateServiceTest extends TestCase
|
||||
$service->shouldReceive('setUser');
|
||||
$service->shouldReceive('updateBudget')->withArgs([Mockery::any(), $budget->id])->twice();
|
||||
|
||||
|
||||
do {
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 1)->first();
|
||||
$count = $journal->transactions()->count();
|
||||
} while ($count !== 2);
|
||||
$withdrawal = $this->getRandomWithdrawal();
|
||||
|
||||
// call update service to update budget. Should call transaction service twice.
|
||||
/** @var JournalUpdateService $service */
|
||||
$service = app(JournalUpdateService::class);
|
||||
$service->updateBudget($journal, $budget->id);
|
||||
$service->updateBudget($withdrawal, $budget->id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,16 +155,12 @@ class JournalUpdateServiceTest extends TestCase
|
||||
$service->shouldReceive('updateCategory')->withArgs([Mockery::any(), 'New category'])->twice();
|
||||
|
||||
|
||||
do {
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 1)->first();
|
||||
$count = $journal->transactions()->count();
|
||||
} while ($count !== 2);
|
||||
$withdrawal = $this->getRandomWithdrawal();
|
||||
|
||||
// call update service to update budget. Should call transaction service twice.
|
||||
/** @var JournalUpdateService $service */
|
||||
$service = app(JournalUpdateService::class);
|
||||
$service->updateCategory($journal, 'New category');
|
||||
$service->updateCategory($withdrawal, 'New category');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user