From c9b56efaaaf535f072e9f00e21d3167d6b9b2b36 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 6 Feb 2016 09:52:31 +0100 Subject: [PATCH] Mock stuff in tests. --- tests/acceptance/Controllers/AccountControllerTest.php | 4 ++++ tests/acceptance/Controllers/BillControllerTest.php | 5 +++++ tests/acceptance/Controllers/TransactionControllerTest.php | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/tests/acceptance/Controllers/AccountControllerTest.php b/tests/acceptance/Controllers/AccountControllerTest.php index 15e326bc4d..fe4a6085d4 100644 --- a/tests/acceptance/Controllers/AccountControllerTest.php +++ b/tests/acceptance/Controllers/AccountControllerTest.php @@ -6,6 +6,7 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ +use Illuminate\Pagination\LengthAwarePaginator; /** * Class AccountControllerTest @@ -82,6 +83,9 @@ class AccountControllerTest extends TestCase */ public function testShow($range) { + $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface'); + $repository->shouldReceive('getJournals')->once()->andReturn(new LengthAwarePaginator([], 0, 50)); + $this->be($this->user()); $this->changeDateRange($this->user(), $range); $this->call('GET', '/accounts/show/1'); diff --git a/tests/acceptance/Controllers/BillControllerTest.php b/tests/acceptance/Controllers/BillControllerTest.php index 023cb3eb05..4c06d4a045 100644 --- a/tests/acceptance/Controllers/BillControllerTest.php +++ b/tests/acceptance/Controllers/BillControllerTest.php @@ -6,6 +6,8 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ +use Carbon\Carbon; +use Illuminate\Support\Collection; /** @@ -94,6 +96,9 @@ class BillControllerTest extends TestCase */ public function testShow($range) { + $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface'); + $repository->shouldReceive('getJournals')->once()->andReturn(new Collection); + $repository->shouldReceive('nextExpectedMatch')->once()->andReturn(new Carbon); $this->be($this->user()); $this->changeDateRange($this->user(), $range); $this->call('GET', '/bills/show/1'); diff --git a/tests/acceptance/Controllers/TransactionControllerTest.php b/tests/acceptance/Controllers/TransactionControllerTest.php index 2b3e21ca51..83613b9fdb 100644 --- a/tests/acceptance/Controllers/TransactionControllerTest.php +++ b/tests/acceptance/Controllers/TransactionControllerTest.php @@ -6,6 +6,7 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ +use Illuminate\Pagination\LengthAwarePaginator; /** @@ -66,6 +67,9 @@ class TransactionControllerTest extends TestCase */ public function testIndex($range) { + $journals = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface'); + $journals->shouldReceive('getJournalsOfTypes')->once()->andReturn(new LengthAwarePaginator([], 0, 50)); + $this->be($this->user()); $this->changeDateRange($this->user(), $range); $this->call('GET', '/transactions/deposit');