From 05aace84e19827cd0534f52d862f30985d11427f Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 30 Jul 2017 13:57:46 +0200 Subject: [PATCH] Fix tests for show() routines. --- .../Controllers/CategoryControllerTest.php | 20 +++---- .../Feature/Controllers/TagControllerTest.php | 60 +++++++++---------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/tests/Feature/Controllers/CategoryControllerTest.php b/tests/Feature/Controllers/CategoryControllerTest.php index 9400b15134..c09e560427 100644 --- a/tests/Feature/Controllers/CategoryControllerTest.php +++ b/tests/Feature/Controllers/CategoryControllerTest.php @@ -371,19 +371,19 @@ class CategoryControllerTest extends TestCase $accountRepos->shouldReceive('getAccountsByType')->once()->andReturn(new Collection); $collector = $this->mock(JournalCollectorInterface::class); - $collector->shouldReceive('setPage')->andReturnSelf()->times(3); - $collector->shouldReceive('setLimit')->andReturnSelf()->times(3); - $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->times(4); - $collector->shouldReceive('setRange')->andReturnSelf()->times(4); + $collector->shouldReceive('setPage')->andReturnSelf()->once(); + $collector->shouldReceive('setLimit')->andReturnSelf()->once(); + $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->twice(); + $collector->shouldReceive('setRange')->andReturnSelf()->twice(); $collector->shouldReceive('setTypes')->andReturnSelf()->times(1); - $collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf()->times(4); - $collector->shouldReceive('withBudgetInformation')->andReturnSelf()->times(3); - $collector->shouldReceive('withCategoryInformation')->andReturnSelf()->times(3); - $collector->shouldReceive('withOpposingAccount')->andReturnSelf()->times(4); - $collector->shouldReceive('setCategory')->andReturnSelf()->times(4); + $collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf()->twice(); + $collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once(); + $collector->shouldReceive('withCategoryInformation')->andReturnSelf()->once(); + $collector->shouldReceive('withOpposingAccount')->andReturnSelf()->twice(); + $collector->shouldReceive('setCategory')->andReturnSelf()->twice(); $collector->shouldReceive('getJournals')->andReturn(new Collection)->times(1); - $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->times(3); + $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once(); $this->be($this->user()); $this->changeDateRange($this->user(), $range); diff --git a/tests/Feature/Controllers/TagControllerTest.php b/tests/Feature/Controllers/TagControllerTest.php index 779713ee06..83f33af1c5 100644 --- a/tests/Feature/Controllers/TagControllerTest.php +++ b/tests/Feature/Controllers/TagControllerTest.php @@ -130,17 +130,17 @@ class TagControllerTest extends TestCase $repository->shouldReceive('lastUseDate')->andReturn(new Carbon)->once(); $repository->shouldReceive('earnedInPeriod')->andReturn('1')->once(); - $collector->shouldReceive('removeFilter')->andReturnSelf()->times(3); + $collector->shouldReceive('removeFilter')->andReturnSelf()->once(); - $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->times(3); - $collector->shouldReceive('setLimit')->andReturnSelf()->times(3); - $collector->shouldReceive('setPage')->andReturnSelf()->times(3); - $collector->shouldReceive('setTag')->andReturnSelf()->times(3); - $collector->shouldReceive('withOpposingAccount')->andReturnSelf()->times(3); - $collector->shouldReceive('withBudgetInformation')->andReturnSelf()->times(3); - $collector->shouldReceive('withCategoryInformation')->andReturnSelf()->times(3); - $collector->shouldReceive('setRange')->andReturnSelf()->times(3); - $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->times(3); + $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once(); + $collector->shouldReceive('setLimit')->andReturnSelf()->once(); + $collector->shouldReceive('setPage')->andReturnSelf()->once(); + $collector->shouldReceive('setTag')->andReturnSelf()->once(); + $collector->shouldReceive('withOpposingAccount')->andReturnSelf()->once(); + $collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once(); + $collector->shouldReceive('withCategoryInformation')->andReturnSelf()->once(); + $collector->shouldReceive('setRange')->andReturnSelf()->once(); + $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once(); $this->be($this->user()); @@ -161,17 +161,17 @@ class TagControllerTest extends TestCase $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once(); - $collector->shouldReceive('removeFilter')->andReturnSelf()->times(3); + $collector->shouldReceive('removeFilter')->andReturnSelf()->once(); $repository->shouldReceive('sumOfTag')->andReturn('1')->once(); - $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->times(3); - $collector->shouldReceive('setLimit')->andReturnSelf()->times(3); - $collector->shouldReceive('setPage')->andReturnSelf()->times(3); - $collector->shouldReceive('setTag')->andReturnSelf()->times(3); - $collector->shouldReceive('withOpposingAccount')->andReturnSelf()->times(3); - $collector->shouldReceive('withBudgetInformation')->andReturnSelf()->times(3); - $collector->shouldReceive('withCategoryInformation')->andReturnSelf()->times(3); - $collector->shouldReceive('setRange')->andReturnSelf()->times(3); - $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->times(3); + $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once(); + $collector->shouldReceive('setLimit')->andReturnSelf()->once(); + $collector->shouldReceive('setPage')->andReturnSelf()->once(); + $collector->shouldReceive('setTag')->andReturnSelf()->once(); + $collector->shouldReceive('withOpposingAccount')->andReturnSelf()->once(); + $collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once(); + $collector->shouldReceive('withCategoryInformation')->andReturnSelf()->once(); + $collector->shouldReceive('setRange')->andReturnSelf()->once(); + $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once(); $this->be($this->user()); @@ -196,16 +196,16 @@ class TagControllerTest extends TestCase $repository->shouldReceive('earnedInPeriod')->andReturn('1')->once(); $repository->shouldReceive('sumOfTag')->andReturn('1')->once(); - $collector->shouldReceive('removeFilter')->andReturnSelf()->times(3); - $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->times(3); - $collector->shouldReceive('setLimit')->andReturnSelf()->times(3); - $collector->shouldReceive('setPage')->andReturnSelf()->times(3); - $collector->shouldReceive('setTag')->andReturnSelf()->times(3); - $collector->shouldReceive('withOpposingAccount')->andReturnSelf()->times(3); - $collector->shouldReceive('withBudgetInformation')->andReturnSelf()->times(3); - $collector->shouldReceive('withCategoryInformation')->andReturnSelf()->times(3); - $collector->shouldReceive('setRange')->andReturnSelf()->times(3); - $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->times(3); + $collector->shouldReceive('removeFilter')->andReturnSelf()->once(); + $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once(); + $collector->shouldReceive('setLimit')->andReturnSelf()->once(); + $collector->shouldReceive('setPage')->andReturnSelf()->once(); + $collector->shouldReceive('setTag')->andReturnSelf()->once(); + $collector->shouldReceive('withOpposingAccount')->andReturnSelf()->once(); + $collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once(); + $collector->shouldReceive('withCategoryInformation')->andReturnSelf()->once(); + $collector->shouldReceive('setRange')->andReturnSelf()->once(); + $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once(); $this->be($this->user());