From 06c6d6096fe2e23656dff17a9a42856b1736fa8a Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 2 May 2015 23:28:04 +0200 Subject: [PATCH] Fixed coverage. --- app/Http/Controllers/BudgetController.php | 5 +---- tests/controllers/BudgetControllerTest.php | 6 ++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index daa31181b4..9fb31e661e 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -8,7 +8,6 @@ use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\LimitRepetition; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; -use Illuminate\Support\Collection; use Input; use Preferences; use Redirect; @@ -191,9 +190,7 @@ class BudgetController extends Controller $journals = $repository->getJournals($budget, $repetition); $limits = !is_null($repetition->id) ? [$repetition->budgetLimit] : $repository->getBudgetLimits($budget); $subTitle = !is_null($repetition->id) ? e($budget->name) . ' in ' . $repetition->startdate->format('F Y') : e($budget->name); - if (!$journals instanceof Collection) { - $journals->setPath('/budgets/show/' . $budget->id); - } + $journals->setPath('/budgets/show/' . $budget->id); return view('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle')); } diff --git a/tests/controllers/BudgetControllerTest.php b/tests/controllers/BudgetControllerTest.php index f57fe39918..edacbcd133 100644 --- a/tests/controllers/BudgetControllerTest.php +++ b/tests/controllers/BudgetControllerTest.php @@ -1,5 +1,6 @@ mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface'); $this->be($budget->user); + $paginator = new LengthAwarePaginator(new Collection, 0, 20, 1); + Amount::shouldReceive('getCurrencyCode')->andReturn('x'); Amount::shouldReceive('format')->andReturn('x'); - $repository->shouldReceive('getJournals')->andReturn(new Collection); + $repository->shouldReceive('getJournals')->andReturn($paginator); $repository->shouldReceive('getBudgetLimits')->andReturn(new Collection); @@ -309,7 +312,6 @@ class BudgetControllerTest extends TestCase Amount::shouldReceive('getCurrencySymbol')->andReturn('X'); - $this->call('GET', '/budgets/income'); $this->assertResponseOk(); $this->assertViewHas('amount');