Fixed some tests so they will not be skipped.

This commit is contained in:
James Cole
2016-01-23 06:54:29 +01:00
parent 049d866f62
commit bf9c1c1875
2 changed files with 44 additions and 17 deletions

View File

@@ -62,8 +62,13 @@ class ChartBudgetControllerTest extends TestCase
public function testMultiYear() public function testMultiYear()
{ {
$budget = new Budget;
$budget->id = 1;
$budget->dateFormatted = '2015';
$budget->budgeted = 120;
$repository = Mockery::mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface'); $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([]); $repository->shouldReceive('getBudgetsAndExpensesPerYear')->once()->andReturn([]);
$this->app->instance('FireflyIII\Repositories\Budget\BudgetRepositoryInterface', $repository); $this->app->instance('FireflyIII\Repositories\Budget\BudgetRepositoryInterface', $repository);

View File

@@ -6,6 +6,7 @@
* This software may be modified and distributed under the terms * This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details. * 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. * Generated by PHPUnit_SkeletonGenerator on 2016-01-19 at 15:39:57.
@@ -40,10 +41,14 @@ class ChartCategoryControllerTest extends TestCase
*/ */
public function testEarnedInPeriod() public function testEarnedInPeriod()
{ {
// $this->be($this->user()); $repository = Mockery::mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
// $response = $this->call('GET', '/chart/category/earned-in-period/default/20150101/20151231/1'); $repository->shouldReceive('earnedForAccountsPerMonth')->once()->andReturn(new Collection);
// $this->assertEquals(200, $response->status());
$this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.'); $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() public function testFrontpage()
{ {
// $this->be($this->user()); $repository = Mockery::mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
// $response = $this->call('GET', '/chart/category/frontpage'); $repository->shouldReceive('spentForAccountsPerMonth')->once()->andReturn(new Collection);
// $this->assertEquals(200, $response->status()); $repository->shouldReceive('sumSpentNoCategory')->once()->andReturn('120');
$this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.');
$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() public function testMultiYear()
{ {
// $this->be($this->user()); $repository = Mockery::mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
// $response = $this->call('GET', '/chart/category/multi-year/default/20150101/20151231/1/1'); $repository->shouldReceive('listMultiYear')->once()->andReturn(new Collection);
// $this->assertEquals(200, $response->status());
$this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.'); $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() 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()); $repository = Mockery::mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$this->markTestSkipped('Skipped because sqlite does not support DATE_FORMAT.'); $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());
} }
} }