Skip to content

Firefly III: a personal finances manager

Fixed coverage.

James Cole06c6d6096fe2
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 @@
<?php
use Carbon\Carbon;
+use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use League\FactoryMuffin\Facade as FactoryMuffin;
@@ -156,9 +157,11 @@ class BudgetControllerTest extends TestCase
$repository = $this->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');