Improve test coverage.

This commit is contained in:
James Cole
2019-07-27 13:54:06 +02:00
parent d94d34ca63
commit 67c0ef6ec6
29 changed files with 788 additions and 346 deletions

View File

@@ -71,7 +71,7 @@ class ReportControllerTest extends TestCase
$netWorth->shouldReceive('getNetWorthByCurrency')->andReturn(
[
[
'currency' => TransactionCurrency::first(),
'currency' => $this->getEuro(),
'balance' => '123',
],
]

View File

@@ -111,8 +111,6 @@ class HomeControllerTest extends TestCase
$pref = new Preference;
$pref->data = [$account->id];
Preferences::shouldReceive('get')->withArgs(['frontPageAccounts', [$account->id]])->atLeast()->once()->andReturn($pref);
//Preferences::shouldReceive('lastActivity')->atLeast()->once()->andReturn('md512345');
//FireflyConfig::shouldReceive('set')->withArgs(['last_update_check', Mockery::any()])->once()->andReturn(new Configuration);
Amount::shouldReceive('formatAnything')->atLeast()->once()->andReturn('x');
Steam::shouldReceive('balance')->atLeast()->once()->andReturn('5');
// mock stuff
@@ -123,9 +121,6 @@ class HomeControllerTest extends TestCase
$euro = $this->getEuro();
// $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
//
//
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
$accountRepos->shouldReceive('count')->andReturn(1)->atLeast()->once();
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');

View File

@@ -128,6 +128,7 @@ class JobStatusControllerTest extends TestCase
$this->mockDefaultSession();
$importRepos->shouldReceive('countTransactions')->once()->andReturn(0);
$importRepos->shouldReceive('countByTag')->atLeast()->once()->andReturn(0);
// call thing.
$this->be($this->user());
@@ -155,6 +156,7 @@ class JobStatusControllerTest extends TestCase
$this->mockDefaultSession();
$importRepos->shouldReceive('countTransactions')->once()->andReturn(2);
$importRepos->shouldReceive('countByTag')->atLeast()->once()->andReturn(2);
$job = new ImportJob;
$job->user_id = $this->user()->id;
@@ -191,6 +193,7 @@ class JobStatusControllerTest extends TestCase
$this->mockDefaultSession();
$importRepos->shouldReceive('countTransactions')->once()->andReturn(1);
$importRepos->shouldReceive('countByTag')->atLeast()->once()->andReturn(1);
$job = new ImportJob;
$job->user_id = $this->user()->id;

View File

@@ -130,7 +130,7 @@ class PiggyBankControllerTest extends TestCase
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
// new account list thing.
$currency = TransactionCurrency::first();
$currency = $this->getEuro();
$currencyRepos->shouldReceive('findNull')->andReturn($currency);
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
@@ -207,7 +207,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff for new account list thing.
$currency = TransactionCurrency::first();
$currency = $this->getEuro();
$account = $this->getRandomAsset();
$currencyRepos->shouldReceive('findNull')->andReturn($currency);