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

@@ -216,7 +216,7 @@ class AvailableBudgetControllerTest extends TestCase
// mock calls:
$repository->shouldReceive('setUser');
$repository->shouldReceive('updateAvailableBudget')->once()->andReturn($availableBudget);
$currencyRepository->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));
$currencyRepository->shouldReceive('findNull')->andReturn($this->getEuro());
// data to submit
$data = [

View File

@@ -62,7 +62,7 @@ class CurrencyControllerTest extends TestCase
public function testStore(): void
{
$currency = TransactionCurrency::first();
$currency = $this->getEuro();
$repository = $this->mock(CurrencyRepositoryInterface::class);
$transformer = $this->mock(CurrencyTransformer::class);
$this->mock(UserRepositoryInterface::class);
@@ -105,7 +105,7 @@ class CurrencyControllerTest extends TestCase
*/
public function testStoreWithDefault(): void
{
$currency = TransactionCurrency::first();
$currency = $this->getEuro();
$repository = $this->mock(CurrencyRepositoryInterface::class);
$transformer = $this->mock(CurrencyTransformer::class);
$userRepository = $this->mock(UserRepositoryInterface::class);
@@ -151,7 +151,7 @@ class CurrencyControllerTest extends TestCase
*/
public function testUpdate(): void
{
$currency = TransactionCurrency::first();
$currency = $this->getEuro();
$repository = $this->mock(CurrencyRepositoryInterface::class);
$transformer = $this->mock(CurrencyTransformer::class);
$this->mock(UserRepositoryInterface::class);
@@ -191,7 +191,7 @@ class CurrencyControllerTest extends TestCase
*/
public function testUpdateWithDefault(): void
{
$currency = TransactionCurrency::first();
$currency = $this->getEuro();
$repository = $this->mock(CurrencyRepositoryInterface::class);
$transformer = $this->mock(CurrencyTransformer::class);
$this->mock(UserRepositoryInterface::class);

View File

@@ -154,7 +154,7 @@ class PiggyBankControllerTest extends TestCase
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
$currencyRepos->shouldReceive('setUser');
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::first());
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn($this->getEuro());
$data = [
'name' => 'new pigy bank ' . $this->randomInt(),

View File

@@ -69,7 +69,7 @@ class SummaryControllerTest extends TestCase
$netWorth = $this->mock(NetWorthInterface::class);
// data
$euro = TransactionCurrency::find(1);
$euro = $this->getEuro();
$budget = $this->user()->budgets()->inRandomOrder()->first();
$account = $this->getRandomAsset();
$journals = [
@@ -162,7 +162,7 @@ class SummaryControllerTest extends TestCase
$date->addWeek();
// data
$euro = TransactionCurrency::find(1);
$euro = $this->getEuro();
$budget = $this->user()->budgets()->inRandomOrder()->first();
$account = $this->getRandomAsset();
$journals = [