Improve test coverage.

This commit is contained in:
James Cole
2018-09-02 20:13:25 +02:00
parent 96dd89fbeb
commit de754ca4e0
31 changed files with 861 additions and 385 deletions

View File

@@ -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');
}