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

@@ -191,7 +191,7 @@ class BoxControllerTest extends TestCase
$this->mockDefaultSession();
$result = [
[
'currency' => TransactionCurrency::find(1),
'currency' => $this->getEuro(),
'balance' => '3',
],
];
@@ -205,7 +205,7 @@ class BoxControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos->shouldReceive('getActiveAccountsByType')->andReturn(new Collection([$this->user()->accounts()->first()]));
$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));
$currencyRepos->shouldReceive('findNull')->andReturn($this->getEuro());
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1');
@@ -224,7 +224,7 @@ class BoxControllerTest extends TestCase
$this->mockDefaultSession();
$result = [
[
'currency' => TransactionCurrency::find(1),
'currency' => $this->getEuro(),
'balance' => '3',
],
];
@@ -237,7 +237,7 @@ class BoxControllerTest extends TestCase
$netWorthHelper->shouldReceive('getNetWorthByCurrency')->once()->andReturn($result);
$accountRepos->shouldReceive('getActiveAccountsByType')->andReturn(new Collection([$this->user()->accounts()->first()]));
$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));
$currencyRepos->shouldReceive('findNull')->andReturn($this->getEuro());
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1');
@@ -261,7 +261,7 @@ class BoxControllerTest extends TestCase
$this->mockDefaultSession();
$result = [
[
'currency' => TransactionCurrency::find(1),
'currency' => $this->getEuro(),
'balance' => '3',
],
];
@@ -274,7 +274,7 @@ class BoxControllerTest extends TestCase
$netWorthHelper->shouldReceive('getNetWorthByCurrency')->once()->andReturn($result);
$accountRepos->shouldReceive('getActiveAccountsByType')->andReturn(new Collection([$this->user()->accounts()->first()]));
$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));
$currencyRepos->shouldReceive('findNull')->andReturn($this->getEuro());
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1');
@@ -297,7 +297,7 @@ class BoxControllerTest extends TestCase
$this->mockDefaultSession();
$result = [
[
'currency' => TransactionCurrency::find(1),
'currency' => $this->getEuro(),
'balance' => '3',
],
];
@@ -328,7 +328,7 @@ class BoxControllerTest extends TestCase
$this->mockDefaultSession();
$result = [
[
'currency' => TransactionCurrency::find(1),
'currency' => $this->getEuro(),
'balance' => '3',
],
];
@@ -341,7 +341,7 @@ class BoxControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos->shouldReceive('getActiveAccountsByType')->andReturn(new Collection([$this->user()->accounts()->first()]));
$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));
$currencyRepos->shouldReceive('findNull')->andReturn($this->getEuro());
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('0');
@@ -360,7 +360,7 @@ class BoxControllerTest extends TestCase
$this->mockDefaultSession();
$result = [
[
'currency' => TransactionCurrency::find(1),
'currency' => $this->getEuro(),
'balance' => '3',
],
];
@@ -375,7 +375,7 @@ class BoxControllerTest extends TestCase
$netWorthHelper->shouldReceive('getNetWorthByCurrency')->once()->andReturn($result);
$accountRepos->shouldReceive('getActiveAccountsByType')->andReturn(new Collection([$account]));
$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));
$currencyRepos->shouldReceive('findNull')->andReturn($this->getEuro());
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountRole'])->andReturn('ccAsset');
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn('1');