mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 23:50:09 +00:00
Fix tests for current feature set.
This commit is contained in:
@@ -93,6 +93,8 @@ class JobStatusControllerTest extends TestCase
|
||||
$job->file_type = '';
|
||||
$job->save();
|
||||
|
||||
$importRepos->shouldReceive('countTransactions')->once()->andReturn(0);
|
||||
|
||||
// call thing.
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.job.status.json', [$job->key]));
|
||||
@@ -120,6 +122,8 @@ class JobStatusControllerTest extends TestCase
|
||||
$job->tag()->associate($tag);
|
||||
$job->save();
|
||||
|
||||
$importRepos->shouldReceive('countTransactions')->once()->andReturn(0);
|
||||
|
||||
// call thing.
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.job.status.json', [$job->key]));
|
||||
@@ -143,6 +147,8 @@ class JobStatusControllerTest extends TestCase
|
||||
$second = $this->user()->transactionJournals()->where('id', '!=', $journal->id)->first();
|
||||
$tag->transactionJournals()->sync([$journal->id, $second->id]);
|
||||
|
||||
$importRepos->shouldReceive('countTransactions')->once()->andReturn(2);
|
||||
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'Dfake_job_' . random_int(1, 10000);
|
||||
@@ -175,6 +181,8 @@ class JobStatusControllerTest extends TestCase
|
||||
$journal = $this->user()->transactionJournals()->first();
|
||||
$tag->transactionJournals()->sync([$journal->id]);
|
||||
|
||||
$importRepos->shouldReceive('countTransactions')->once()->andReturn(1);
|
||||
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'Efake_job_' . random_int(1, 10000);
|
||||
|
||||
@@ -57,14 +57,22 @@ class ReconcileControllerTest extends TestCase
|
||||
*/
|
||||
public function testOverview(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
|
||||
$transactions = $this->user()->transactions()->inRandomOrder()->take(3)->get();
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$transactions = $this->user()->transactions()->inRandomOrder()->take(3)->get();
|
||||
$transactions =$transactions->each(
|
||||
function (Transaction $transaction) {
|
||||
$transaction->transaction_amount = '5';
|
||||
}
|
||||
);
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository->shouldReceive('firstNull')->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('getTransactionsById')->andReturn($transactions)->twice();
|
||||
|
||||
$accountRepos->shouldReceive('findNull')->andReturn($this->getRandomAsset())->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->atLeast()->once()->andReturn(1);
|
||||
|
||||
$parameters = [
|
||||
'startBalance' => '0',
|
||||
'endBalance' => '10',
|
||||
@@ -83,8 +91,8 @@ class ReconcileControllerTest extends TestCase
|
||||
*/
|
||||
public function testOverviewNotAsset(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
|
||||
|
||||
$account = $this->user()->accounts()->where('account_type_id', '!=', 3)->first();
|
||||
@@ -107,8 +115,8 @@ class ReconcileControllerTest extends TestCase
|
||||
*/
|
||||
public function testTransactions(): void
|
||||
{
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
|
||||
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1')->atLeast()->once();
|
||||
@@ -125,8 +133,8 @@ class ReconcileControllerTest extends TestCase
|
||||
*/
|
||||
public function testTransactionsInitialBalance(): void
|
||||
{
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user