Skip to content

Firefly III: a personal finances manager

Expand test coverage

James Colef85bdcebaf82
diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php
index 1e208acdd9..a7f350132d 100644
--- a/app/Http/Controllers/Transaction/SingleController.php
+++ b/app/Http/Controllers/Transaction/SingleController.php
@@ -443,7 +443,7 @@ class SingleController extends Controller
foreach ($accounts as $account) {
$type = $account->getMeta('accountRole');
if (0 === strlen($type)) {
- $type = 'no_account_type';
+ $type = 'no_account_type'; // @codeCoverageIgnore
}
$key = strval(trans('firefly.opt_group_' . $type));
$return[$key][$account->id] = $account->name;
@@ -463,7 +463,7 @@ class SingleController extends Controller
foreach ($accounts as $account) {
$type = $account->getMeta('accountRole');
if (0 === strlen($type)) {
- $type = 'no_account_type';
+ $type = 'no_account_type'; // @codeCoverageIgnore
}
$key = strval(trans('firefly.opt_group_' . $type));
$return[$key][$account->id] = $account->name;
@@ -482,7 +482,7 @@ class SingleController extends Controller
$count = $this->repository->countTransactions($journal);
if ($count > 2) {
- return true;
+ return true; // @codeCoverageIgnore
}
return false;
diff --git a/tests/Feature/Controllers/Transaction/SingleControllerTest.php b/tests/Feature/Controllers/Transaction/SingleControllerTest.php
index 24639fabf1..781c965ef3 100644
--- a/tests/Feature/Controllers/Transaction/SingleControllerTest.php
+++ b/tests/Feature/Controllers/Transaction/SingleControllerTest.php
@@ -75,9 +75,10 @@ class SingleControllerTest extends TestCase
*/
public function testCreate()
{
+ $accounts = $this->user()->accounts()->where('account_type_id',3)->get();
Steam::shouldReceive('phpBytes')->andReturn(2048);
$repository = $this->mock(AccountRepositoryInterface::class);
- $repository->shouldReceive('getActiveAccountsByType')->once()->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection);
+ $repository->shouldReceive('getActiveAccountsByType')->once()->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn($accounts);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$budgetRepos->shouldReceive('getActiveBudgets')->andReturn(new Collection)->once();
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
@@ -124,6 +125,7 @@ class SingleControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedAccountList
+ * @covers \FireflyIII\Http\Controllers\Transaction\SingleController::isSplitJournal
*/
public function testEdit()
{