mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-06 12:27:25 +00:00
Built chart tests.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use League\FactoryMuffin\Facade as FactoryMuffin;
|
||||
|
||||
/**
|
||||
* Class ChartCategoryControllerTest
|
||||
*/
|
||||
@@ -25,22 +28,83 @@ class ChartCategoryControllerTest extends TestCase
|
||||
|
||||
public function testAll()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
|
||||
$category = FactoryMuffin::create('FireflyIII\Models\Category');
|
||||
$this->be($category->user);
|
||||
|
||||
$this->call('GET', '/chart/category/'.$category->id.'/all');
|
||||
$this->assertResponseOk();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testFrontpage()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
// make data:
|
||||
$set = [
|
||||
['name' => 'Something', 'sum' => 100],
|
||||
['name' => 'Something Else', 'sum' => 200],
|
||||
['name' => 'Something Else Entirely', 'sum' => 200]
|
||||
];
|
||||
|
||||
// mock!
|
||||
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
|
||||
|
||||
// fake!
|
||||
$repository->shouldReceive('getCategoriesAndExpensesCorrected')->andReturn($set);
|
||||
|
||||
//getCategoriesAndExpensesCorrected
|
||||
|
||||
$this->call('GET', '/chart/category/frontpage');
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
public function testMonth()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$category = FactoryMuffin::create('FireflyIII\Models\Category');
|
||||
$this->be($category->user);
|
||||
|
||||
$this->call('GET', '/chart/category/'.$category->id.'/month');
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
public function testYear()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
$categories = new Collection([FactoryMuffin::create('FireflyIII\Models\Category')]);
|
||||
|
||||
// mock!
|
||||
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
|
||||
|
||||
// fake!
|
||||
$repository->shouldReceive('getCategories')->andReturn($categories);
|
||||
$repository->shouldReceive('spentInPeriodCorrected')->andReturn(0);
|
||||
|
||||
$this->call('GET', '/chart/category/year/2015');
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
public function testYearShared()
|
||||
{
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
$categories = new Collection([FactoryMuffin::create('FireflyIII\Models\Category')]);
|
||||
|
||||
// mock!
|
||||
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
|
||||
|
||||
// fake!
|
||||
$repository->shouldReceive('getCategories')->andReturn($categories);
|
||||
$repository->shouldReceive('spentInPeriodCorrected')->andReturn(0);
|
||||
|
||||
$this->call('GET', '/chart/category/year/2015/shared');
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user