Improve test coverage.

This commit is contained in:
James Cole
2019-08-03 04:46:47 +02:00
parent 00dee03709
commit 40dd2e0f7f
21 changed files with 118 additions and 410 deletions

View File

@@ -69,7 +69,7 @@ class NetWorthTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
// mock calls to facades
Amount::shouldReceive('getDefaultCurrencyByUser')->once()->andReturn(TransactionCurrency::find(1));
Amount::shouldReceive('getDefaultCurrencyByUser')->once()->andReturn($this->getEuro());
Steam::shouldReceive('balancesByAccounts')->once()->withAnyArgs()->andReturn($balanceInfo);
// mock other calls:
@@ -77,7 +77,7 @@ class NetWorthTest extends TestCase
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->times(2)->andReturn('1');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'account_role'])->times(2)->andReturn('defaultAsset');
$currencyRepos->shouldReceive('setUser')->once();
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1))->times(1);
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn($this->getEuro())->times(1);
$helper = new NetWorth();
@@ -106,7 +106,7 @@ class NetWorthTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
// mock calls to facades
Amount::shouldReceive('getDefaultCurrencyByUser')->once()->andReturn(TransactionCurrency::find(1));
Amount::shouldReceive('getDefaultCurrencyByUser')->once()->andReturn($this->getEuro());
Steam::shouldReceive('balancesByAccounts')->once()->withAnyArgs()->andReturn($balanceInfo);
// mock other calls:
@@ -114,7 +114,7 @@ class NetWorthTest extends TestCase
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->times(2)->andReturn('1');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'account_role'])->times(2)->andReturn('defaultAsset', 'ccAsset');
$currencyRepos->shouldReceive('setUser')->once();
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1))->times(1);
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn($this->getEuro())->times(1);
$helper = new NetWorth();