Skip to content

Firefly III: a personal finances manager

Fixed some tests so they will not be skipped.

James Colebf9c1c1875fe
diff --git a/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php b/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php
index 81f6dd3a66..78d71b7930 100644
--- a/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php
+++ b/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php
@@ -62,8 +62,13 @@ class ChartBudgetControllerTest extends TestCase
public function testMultiYear()
{
+ $budget = new Budget;
+ $budget->id = 1;
+ $budget->dateFormatted = '2015';
+ $budget->budgeted = 120;
+
$repository = Mockery::mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
- $repository->shouldReceive('getBudgetedPerYear')->once()->andReturn(new Collection);
+ $repository->shouldReceive('getBudgetedPerYear')->once()->andReturn(new Collection([$budget]));
$repository->shouldReceive('getBudgetsAndExpensesPerYear')->once()->andReturn([]);
$this->app->instance('FireflyIII\Repositories\Budget\BudgetRepositoryInterface', $repository);
diff --git a/tests/acceptance/Controllers/Chart/ChartCategoryControllerTest.php b/tests/acceptance/Controllers/Chart/ChartCategoryControllerTest.php
index 470ff0c240..09041d064a 100644
--- a/tests/acceptance/Controllers/Chart/ChartCategoryControllerTest.php
+++ b/tests/acceptance/Controllers/Chart/ChartCategoryControllerTest.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\Support\Collection;
/**
* Generated by PHPUnit_SkeletonGenerator on 2016-01-19 at 15:39:57.
@@ -40,10 +41,14 @@ class ChartCategoryControllerTest extends TestCase
*/
public function testEarnedInPeriod()
{
-// $this->be($this->user());
-// $response = $this->call('GET', '/chart/category/earned-in-period/default/20150101/20151231/1');
-// $this->assertEquals(200, $response->status());
- $this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.');
+ $repository = Mockery::mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
+ $repository->shouldReceive('earnedForAccountsPerMonth')->once()->andReturn(new Collection);
+
+ $this->app->instance('FireflyIII\Repositories\Category\CategoryRepositoryInterface', $repository);
+
+ $this->be($this->user());
+ $response = $this->call('GET', '/chart/category/earned-in-period/default/20150101/20151231/1');
+ $this->assertEquals(200, $response->status());
}
/**
@@ -51,10 +56,16 @@ class ChartCategoryControllerTest extends TestCase
*/
public function testFrontpage()
{
-// $this->be($this->user());
-// $response = $this->call('GET', '/chart/category/frontpage');
-// $this->assertEquals(200, $response->status());
- $this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.');
+ $repository = Mockery::mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
+ $repository->shouldReceive('spentForAccountsPerMonth')->once()->andReturn(new Collection);
+ $repository->shouldReceive('sumSpentNoCategory')->once()->andReturn('120');
+
+ $this->app->instance('FireflyIII\Repositories\Category\CategoryRepositoryInterface', $repository);
+
+
+ $this->be($this->user());
+ $response = $this->call('GET', '/chart/category/frontpage');
+ $this->assertEquals(200, $response->status());
}
/**
@@ -62,10 +73,14 @@ class ChartCategoryControllerTest extends TestCase
*/
public function testMultiYear()
{
-// $this->be($this->user());
-// $response = $this->call('GET', '/chart/category/multi-year/default/20150101/20151231/1/1');
-// $this->assertEquals(200, $response->status());
- $this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.');
+ $repository = Mockery::mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
+ $repository->shouldReceive('listMultiYear')->once()->andReturn(new Collection);
+
+ $this->app->instance('FireflyIII\Repositories\Category\CategoryRepositoryInterface', $repository);
+
+ $this->be($this->user());
+ $response = $this->call('GET', '/chart/category/multi-year/default/20150101/20151231/1/1');
+ $this->assertEquals(200, $response->status());
}
/**
@@ -84,9 +99,16 @@ class ChartCategoryControllerTest extends TestCase
*/
public function testSpentInPeriod()
{
-// $this->be($this->user());
-// $response = $this->call('GET', '/chart/category/spent-in-period/default/20150101/20151231/1');
-// $this->assertEquals(200, $response->status());
- $this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.');
+
+
+ $repository = Mockery::mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
+ $repository->shouldReceive('spentForAccountsPerMonth')->once()->andReturn(new Collection);
+
+ $this->app->instance('FireflyIII\Repositories\Category\CategoryRepositoryInterface', $repository);
+
+ $this->be($this->user());
+ $response = $this->call('GET', '/chart/category/spent-in-period/default/20150101/20151231/1');
+ $this->assertEquals(200, $response->status());
+
}
}