Updated tests

This commit is contained in:
James Cole
2018-05-31 20:04:19 +02:00
parent 68e7d45f63
commit fb07c68132
2 changed files with 11 additions and 0 deletions

View File

@@ -205,6 +205,7 @@ class PiggyBankControllerTest extends TestCase
$repository->shouldReceive('getCurrentAmount')->andReturn('10'); $repository->shouldReceive('getCurrentAmount')->andReturn('10');
$repository->shouldReceive('setUser'); $repository->shouldReceive('setUser');
$repository->shouldReceive('correctOrder'); $repository->shouldReceive('correctOrder');
$repository->shouldReceive('getSuggestedMonthlyAmount')->andReturn('1');
Steam::shouldReceive('balance')->twice()->andReturn('1'); Steam::shouldReceive('balance')->twice()->andReturn('1');
@@ -332,8 +333,13 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('setUser')->once();
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('getEvents')->andReturn(new Collection); $repository->shouldReceive('getEvents')->andReturn(new Collection);
$repository->shouldReceive('getSuggestedMonthlyAmount')->andReturn('1');
$repository->shouldReceive('getCurrentAmount')->andReturn('1');
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('piggy-banks.show', [1])); $response = $this->get(route('piggy-banks.show', [1]));

View File

@@ -50,6 +50,8 @@ class PiggyBankTransformerTest extends TestCase
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$repository->shouldReceive('setUser')->once(); $repository->shouldReceive('setUser')->once();
$repository->shouldReceive('getCurrentAmount')->andReturn('12.34')->once(); $repository->shouldReceive('getCurrentAmount')->andReturn('12.34')->once();
$repository->shouldReceive('getSuggestedMonthlyAmount')->andReturn('12.34')->once();
// make new account and piggy // make new account and piggy
$account = Account::create( $account = Account::create(
@@ -94,10 +96,12 @@ class PiggyBankTransformerTest extends TestCase
$currencyRepos->shouldReceive('setUser')->once(); $currencyRepos->shouldReceive('setUser')->once();
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1))->once(); $currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1))->once();
// mock repository: // mock repository:
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$repository->shouldReceive('setUser')->once(); $repository->shouldReceive('setUser')->once();
$repository->shouldReceive('getCurrentAmount')->andReturn('12.34')->once(); $repository->shouldReceive('getCurrentAmount')->andReturn('12.34')->once();
$repository->shouldReceive('getSuggestedMonthlyAmount')->andReturn('12.34')->once();
// make new account and piggy // make new account and piggy
$account = Account::create( $account = Account::create(
@@ -155,6 +159,7 @@ class PiggyBankTransformerTest extends TestCase
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$repository->shouldReceive('setUser')->once(); $repository->shouldReceive('setUser')->once();
$repository->shouldReceive('getCurrentAmount')->andReturn('12.34')->once(); $repository->shouldReceive('getCurrentAmount')->andReturn('12.34')->once();
$repository->shouldReceive('getSuggestedMonthlyAmount')->andReturn('12.34')->once();
// make new account and piggy // make new account and piggy
$account = Account::create( $account = Account::create(