Skip to content

Firefly III: a personal finances manager

Fixed tests.

James Colef6e195736fd3
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 9dfc4f81ff..a5e90ae26e 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -26,7 +26,7 @@ class AccountController extends \BaseController
'initial' => [],
'cash' => []
];
- $total = $all->count();
+ $total = count($all);
foreach ($all as $account) {
diff --git a/app/tests/controllers/AccountControllerTest.php b/app/tests/controllers/AccountControllerTest.php
index e81b462161..ff1114f222 100644
--- a/app/tests/controllers/AccountControllerTest.php
+++ b/app/tests/controllers/AccountControllerTest.php
@@ -7,20 +7,22 @@ class AccountControllerTest extends TestCase
parent::setUp();
}
- public function testIndex() {
+ public function testIndex()
+ {
$list = [
- 'personal' => [],
+ 'personal' => [],
'beneficiaries' => [],
- 'initial' => [],
- 'cash' => []
+ 'initial' => [],
+ 'cash' => []
];
// mock:
View::shouldReceive('share');
View::shouldReceive('make')->with('accounts.index')->once()->andReturn(\Mockery::self())
- ->shouldReceive('with')->once()->with('accounts',$list);
+ ->shouldReceive('with')->once()->with('accounts', $list)->andReturn(\Mockery::self())
+ ->shouldReceive('with')->once()->with('total', 0)->andReturn(\Mockery::self());
// mock account repository:
$accounts = $this->mock('Firefly\Storage\Account\AccountRepositoryInterface');
@@ -59,4 +61,10 @@ class AccountControllerTest extends TestCase
// test
$this->assertResponseOk();
}
+
+
+ public function tearDown()
+ {
+ Mockery::close();
+ }
}
\ No newline at end of file
diff --git a/app/tests/controllers/HomeControllerTest.php b/app/tests/controllers/HomeControllerTest.php
index 935580c7b3..c05d72771d 100644
--- a/app/tests/controllers/HomeControllerTest.php
+++ b/app/tests/controllers/HomeControllerTest.php
@@ -29,6 +29,7 @@ class HomeControllerTest extends TestCase
// mock preferences helper:
$preferences = $this->mock('Firefly\Helper\Preferences\PreferencesHelperInterface');
$preferences->shouldReceive('get')->with('frontpageAccounts',[])->andReturn(new \Preference)->once();
+ $preferences->shouldReceive('get')->with('viewRange', 'week')->once()->andReturn('week');
// call
$this->call('GET', '/');
@@ -37,4 +38,8 @@ class HomeControllerTest extends TestCase
$this->assertResponseOk();
}
+ public function tearDown()
+ {
+ Mockery::close();
+ }
}
\ No newline at end of file
diff --git a/app/tests/controllers/MigrationControllerTest.php b/app/tests/controllers/MigrationControllerTest.php
index f0e36523da..ce72019210 100644
--- a/app/tests/controllers/MigrationControllerTest.php
+++ b/app/tests/controllers/MigrationControllerTest.php
@@ -19,4 +19,9 @@ class MigrationControllerTest extends TestCase
// test
$this->assertResponseOk();
}
+
+ public function tearDown()
+ {
+ Mockery::close();
+ }
}
\ No newline at end of file
diff --git a/app/tests/controllers/ProfileControllerTest.php b/app/tests/controllers/ProfileControllerTest.php
index c9521385cf..9345e8740c 100644
--- a/app/tests/controllers/ProfileControllerTest.php
+++ b/app/tests/controllers/ProfileControllerTest.php
@@ -140,4 +140,9 @@ class ProfileControllerTest extends TestCase
$this->assertSessionHas('success', 'Password changed!');
}
+ public function tearDown()
+ {
+ Mockery::close();
+ }
+
}
\ No newline at end of file