diff --git a/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php b/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php index 2968da7905..81f6dd3a66 100644 --- a/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php +++ b/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php @@ -6,6 +6,9 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ +use Carbon\Carbon; +use FireflyIII\Models\Budget; +use Illuminate\Support\Collection; /** * Generated by PHPUnit_SkeletonGenerator on 2016-01-19 at 15:39:57. @@ -18,10 +21,17 @@ class ChartBudgetControllerTest extends TestCase */ public function testBudget() { -// $this->be($this->user()); -// $response = $this->call('GET', '/chart/budget/1'); -// $this->assertEquals(200, $response->status()); - $this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.'); + + $repository = Mockery::mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface'); + $repository->shouldReceive('getExpensesPerMonth')->once()->andReturn(new Collection([new Budget])); + $repository->shouldReceive('getFirstBudgetLimitDate')->once()->andReturn(new Carbon); + + $this->app->instance('FireflyIII\Repositories\Budget\BudgetRepositoryInterface', $repository); + + $this->be($this->user()); + $response = $this->call('GET', '/chart/budget/1'); + $this->assertEquals(200, $response->status()); + //$this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.'); } /** @@ -51,10 +61,17 @@ class ChartBudgetControllerTest extends TestCase */ public function testMultiYear() { -// $this->be($this->user()); -// $response = $this->call('GET', '/chart/budget/multi-year/default/20150101/20160101/1/1'); -// $this->assertEquals(200, $response->status()); - $this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.'); + + $repository = Mockery::mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface'); + $repository->shouldReceive('getBudgetedPerYear')->once()->andReturn(new Collection); + $repository->shouldReceive('getBudgetsAndExpensesPerYear')->once()->andReturn([]); + + $this->app->instance('FireflyIII\Repositories\Budget\BudgetRepositoryInterface', $repository); + + + $this->be($this->user()); + $response = $this->call('GET', '/chart/budget/multi-year/default/20150101/20160101/1/1'); + $this->assertEquals(200, $response->status()); } @@ -63,10 +80,14 @@ class ChartBudgetControllerTest extends TestCase */ public function testYear() { -// $this->be($this->user()); -// $response = $this->call('GET', '/chart/budget/year/default/20150101/201512031/1'); -// $this->assertEquals(200, $response->status()); - $this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.'); + $repository = Mockery::mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface'); + $repository->shouldReceive('getBudgetsAndExpensesPerMonth')->once()->andReturn([]); + + $this->app->instance('FireflyIII\Repositories\Budget\BudgetRepositoryInterface', $repository); + + $this->be($this->user()); + $response = $this->call('GET', '/chart/budget/year/default/20150101/20151231/1'); + $this->assertEquals(200, $response->status()); } }