From 477acafc4ce64dc052231f3647d1aef7a1aaca9c Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 21 Mar 2017 20:46:14 +0100 Subject: [PATCH] Improve test coverage. --- .../Controllers/CategoryControllerTest.php | 87 ++++++++++--------- .../Controllers/NewUserControllerTest.php | 22 +++++ 2 files changed, 66 insertions(+), 43 deletions(-) diff --git a/tests/Feature/Controllers/CategoryControllerTest.php b/tests/Feature/Controllers/CategoryControllerTest.php index e8f7ccc705..ae0531d9e9 100644 --- a/tests/Feature/Controllers/CategoryControllerTest.php +++ b/tests/Feature/Controllers/CategoryControllerTest.php @@ -101,11 +101,12 @@ class CategoryControllerTest extends TestCase public function testIndex() { // mock stuff + $category = factory(Category::class)->make(); $repository = $this->mock(CategoryRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); - $repository->shouldReceive('getCategories')->andReturn(new Collection); - $repository->shouldReceive('lastUseDate')->andReturn(new Carbon); + $repository->shouldReceive('getCategories')->andReturn(new Collection([$category]))->once(); + $repository->shouldReceive('lastUseDate')->andReturn(new Carbon)->once(); $this->be($this->user()); $response = $this->get(route('categories.index')); @@ -220,47 +221,6 @@ class CategoryControllerTest extends TestCase $response->assertSee('